Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have the following two domains:

Both point to same folder which is "public_html". What I want is a different robots.txt file for each domain. So when someone browse then a different file is shown. And when someone go to then a different file is shown. How can I do this using URL rewriting in .htacces?


share|improve this question

migrated from Mar 15 '11 at 10:27

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 6 down vote accepted

Remeber that no one from internet can see your directory tree, so and are completely diffrent sites for us and search robots. You can do that by checing http host in query.

RewriteCond %{HTTP_HOST} ^test
RewriteRule robots.txt someotherrobots.txt
share|improve this answer
Thanks man. It works! – Ali Mar 18 '11 at 5:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.