This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Redirects based on specific domains
Author
Message |
sureround
Newbie


Joined: 29 May 2009
Posts: 3
Posted: 24 October 2011 at 3:07pm

I have 8 websites running on a single server off of a single folder/codeset. I need to figure out a way to redirect robots.txt and sitemap.xml requests to domain1-robots.txt and domain8-robots.txt based on the actual domain name. I have been trying various rewrite conditions and rules and haven't been able to make it stick. I am using the Free version of Isapi rewrite 3.

Basically I need to accomplish this:

If domain is test.com then 301 redirect robots.txt to test-robots.txt
If domain is park.com then 301 redirect robots.txt to park-robots.txt

Any ideas? Thanks
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 25 October 2011 at 1:50am

Please try the following ruleset in httpd.conf:

RewriteBase
RewriteCond %{HTTP_HOST} ^(?:www\.)?test.com$ [NC]
RewriteRule ^/robots\.txt$ /test-robots.txt [NC,R=301,L]

RewriteCond %{HTTP_HOST} ^(?:www\.)?park.com$ [NC]
RewriteRule ^/robots\.txt$ /park-robots.txt [NC,R=301,L]


__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version