.htaccess - mod_rewrite 所有 robots.txt 请求到默认文件,服务器范围

标签 .htaccess mod-rewrite apache2 robots.txt robot

所以,我有一个运行 OpenSuse 和 apache 的开发服务器。此服务器上有大量项目,其中一些有在线/实时对应项目。

每个项目都有一个单独的子域。

如何将对 robots.txt 的所有请求重写为一个服务器范围内的“默认”文件

我的目标是防止搜索机器人编制索引。

最佳答案

相信没有比在每个VirtualHost 指令中设置一个Alias 更简单的方法了:

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

不过,我很高兴接受真正的全局解决方案的纠正。

关于.htaccess - mod_rewrite 所有 robots.txt 请求到默认文件,服务器范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5236308/

相关文章:

php - 在 .htaccess 中的重定向链接中添加问号

apache - 是否需要重新启动apache才能使.htaccess中的重写规则生效?

regex - apache 正则表达式 和 proxypassmatch

PHPIniDir 在 Windows 7 下损坏了吗?

python - 导入错误 : Could not import settings 'health_tweets.settings' No module named health_tweets. 设置

.htaccess - Cakephp如何从URL中删除结尾的'/'以进行SEO

wordpress - 网站有太多重定向循环

.htaccess - 具有智能感知支持的 Eclipse/Netbeans 的编辑器或插件

mod-rewrite - 从 URL 中删除特定的查询参数

tomcat - Apache HTTP Server 和 Tomcat 在一台机器上