subdomain to tld redirect

Using a single web hosting account to host multiple sites

subdomain to tld redirect

Postby rhodesia1 » Wed Nov 15, 2006 3:17 pm

Hello

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]
but it doesn't work.
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]
and it just redirect to the root of mydomainname.com

Thanks in advance for any help.
rhodesia1
 
Posts: 3
Joined: Wed Nov 15, 2006 3:05 pm

Postby richardk » Thu Nov 16, 2006 1:00 pm

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 doubt you can stop it. They must be doing it for a reason. Your best bet is to ask them.

You could try this, but it'll probably just cause an infinite loop. In a .htaccess file in your document root:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.mydomainname\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomainname.com/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby rhodesia1 » Thu Nov 16, 2006 8:32 pm

Thanks for the reply, you are correct that just causes an infinite loop.

I will ask them if this is by design or... if anyone can think of a way I'd appreciate the feedback.
rhodesia1
 
Posts: 3
Joined: Wed Nov 15, 2006 3:05 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 109 guests

cron