View Full Version : 301 redirect of index.html also redirects subdomain....

08-17-2011, 09:30 PM
How can I successfully do:

redirect 301 /index.html www.mysite.com/page.extension


subdomain.mysite.com being redirected as well

Any help would be appreciated.

08-18-2011, 08:29 AM
I'm assuming you have the code in an .htaccess file. Either...

Have the sub-domains DocumentRoot different to the main one, so that it never hit the file (unlikely to be useful as you are obviously using the same code base).
Move the code into the VirtualHost for the main domain (probably haven't got access to it, especially if you're on shared hosting).
Use mod_rewrite to redirect instead.

RewriteCond %{HTTP_HOST} ^www.mysite.com
RewriteRule index.html /page.extension [R=301,L]