...

View Full Version : Redirect example.com/robots.txt to example2.com/example/robots.txt



ahayzen
05-24-2010, 02:11 PM
Hi I have a parked domain (example.com) and I am trying to redirect them to the primary address (example2.com) but within a folder.

So requests for
example.com/robots.txt
would go to
example2.com/example/robots.txt

I also need it to work with and without www.

The current code i have got is


RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteCond %{REQUEST_URI} ^\/robots\.txt
RewriteRule ^/?$ "http\:\/\/www\.example2\.com\/example\/robots\.txt" [R=301,L]


but it doesn't work.

Thanks in advance

Andy

ahayzen
05-24-2010, 02:15 PM
Or if you can work out a way of redirecting
example.com/*
to
example2.com/example/*

That would be even better.

Andy

abduraooft
05-24-2010, 02:45 PM
I don't think, you can place the robots.txt file of a domain under another one.

ahayzen
05-24-2010, 02:48 PM
After a bit of head scratching and lots of reading I've done it


RewriteCond %{HTTP_HOST} example.com
RewriteCond %{REQUEST_URI} !^/example
RewriteRule ^(.*)$ example/$1 [L]

ahayzen
05-24-2010, 02:52 PM
This thread can be marked as Resolved



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum