开发者

mod_rewrite all robots.txt requests to default file, server-wide

开发者 https://www.devze.com 2023-02-16 01:41 出处:网络
So, I have a development server running OpenSuse with apache. There are loads of projects on this server, some of them have an online/live counterpart.

So, I have a development server running OpenSuse with apache. There are loads of projects on this server, some of them have an online/live counterpart.

Each project has a separate subdomain.

How do I开发者_高级运维 rewrite all requests for robots.txt to one "default"-file, server wide?

My goal is to prevent indexing from search-bots.


I believe there is no easier way than to set an Alias in every VirtualHost directive:

Alias /robots.txt /home/path/to/generic/robots.txt

I'm happy to stand corrected by a truly global solution, though.


I was having the same problem and found that I could place the Alias declaration that Pekka suggests in the httpd.conf outside of the VirutalHost directive and it applied to all sites.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号