I have a problem with sub domains and I would like to know if anyone has any idea how to work around it.
I am using a free host and they set up a sub domain (used my username) under their domain for me. I also bought and set up my own TLD domain name. So I have username.hostingaccount.com and mydomainname.com.
Both work fine fopr the index and non folder pages; except if I go to mydomainname.com/forums it redirects to username.hostingaccount.net/forums and ignores my TLD name.
I want to know if mod rewrite or htaccess can stop this, so that if you enter mydomainname.com/subfolder it doesn't load username.hostingaccount.net/subfolder
I have tried this
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^username\.hostingaccount\.net$ [NC]
RewriteRule (.*) http://www.mydomainname.com/ [R=301,L]
so then I tried this in the folders
- Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} username\.hostingaccount\.net
RewriteRule ^(.*) http://mydomainename.com/$1 [R=301,L]
Thanks in advance for any help.