I'm using shared hosting at GoDaddy, meaning that there's a default domain name and all other domains are sharing the same server space although they can be linked directly from their domain names if the linked files are in their associated subfolders.
As I'm not using the default main domain for anything but I have several subdomains, pages in subfolders and obviously multiple other domains that need to run, I'm trying to redirect my default main domain ONLY to an external blog of mine.
This is the code I'm using:
- Code: Select all
ErrorDocument 404 /
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.maindomain.com
RewriteRule .* - [L]
RewriteRule (.*) http://external.blog.com/$1 [R=301,L]
As I read about, this was meant to only let the subdomain redirection go through and nothing else, however it seems that everything goes through except for the main domain that rightly gets redirected to the blog.
Can you explain why? Is there a "cleaner" way to setup htaccess to only redirect the main domain or do I have to choose all the exceptions (the ones that can go through?
Simply 301 redirecting the root will not allow to access any subdomains or subfolders however I would like to have that.
Also, if possible, the error page should go to the blog's main page and not to an error page of the blog as it does now.
Thank you very much for your help in advance!
ben