View Single Post
  #5 (permalink)  
Old 05-09-2007, 03:21 PM
brian.mark's Avatar
brian.mark brian.mark is offline
Administrator
 

Join Date: Jul 2004
Location: Omaha
Posts: 2,717
brian.mark RepRank 2brian.mark RepRank 2
Default

Referrer would be for someone clicking from elsewhere and not the current page, so I don't think the above code would work as expected.

I would personally use .htaccess to accomplish this.

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} .*domain1.com
RewriteRule ^$ http://www.domain1.com/page1.html [L]

RewriteCond %{HTTP_HOST} .*domain2.com
RewriteRule ^$ http://www.domain2.com/page2.html [L]
That would allow you to make it work without redirects. The ^$ in the rule means root of the domain only. I put the .* on the conditions to match domain1.com or www.domain1.com. If it's domain1.com without the www, this would redirect. You could create 4 sets of conditions and rules if you wanted to keep that straight, too.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote