Forum Moderators: phranque

Message Too Old, No Replies

Redirect to same doc-root, different domain

forward all traffic from one domain to another

         

hughie

12:46 pm on Feb 24, 2007 (gmt 0)

10+ Year Member



I'm sure this is possible but my googling failed for once.

I have website A in the /public_html/ folder

there are two domains pointing at it, websitea.com, websitebbb.com

if someone arrives at websitebbb.com/fishing.php i want to redirect them to websitea.com/fishing.php.

Can this be done with .htaccess?

Many thanks,
hughie

Brett_Tabke

6:44 pm on Feb 26, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Sure, hard redirect. See if you follow this:

RewriteCond %{HTTP_HOST} ^72\.3\.232\.139 [OR]
RewriteCond %{HTTP_HOST} ^webmasterworld\. [NC]
RewriteRule ^(.*) [webmasterworld.com...] [R=301,L]

That hard redirects anyone coming in on an ip, or non www. domain name to webmasterworld - to the real www.webmasterworld.com

[edited by: jdMorgan at 11:10 pm (utc) on Feb. 26, 2007]
[edit reason] Speling [/edit]

hughie

2:25 pm on Feb 27, 2007 (gmt 0)

10+ Year Member



Hi Brett

Thanks for that, i've done it in PHP currently so i'll give your version a whirl.

Cheers,
hughie