How do i create virtual subdomain using htaccess?

How can I bulk redirect each of the pages from a subdomain to another domain?

  • I want to redirect all requests that start with http://blog.mysite.com to pages that start with http://mysite.com.  i.e. http://blog.mysite.com/*.* -> http://mysite.com/*.* I know I have to do something with the .htaccess file but I can only find the .htaccess file for the http://mysiye.com domain.. I think I have to redirect the subdomain requests somehow but can't figure out how.  (Should I do domain forwarding? will that strip out the remainder of the URl entered?) I have tried entering the following in the .htaccess of http://mysite.com but it doesn't seem to work. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} http://blog.mysite.com [nc] RewriteRule (.*)$ http://mysite.com/%241 [r=301,nc] I'm using Godaddy for the hosting and the DNS manager.

  • Answer:

    You can add a CNAME rule to your nameserver redirecting the blog subdomain to the root domain (@).

Anonymous at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.