【问题标题】:.htaccess redirect to another domain without robots.txt.htaccess 重定向到另一个没有 robots.txt 的域
【发布时间】:2014-09-29 02:38:45
【问题描述】:

我有两个域,这个重定向规则:

RewriteEngine On
RewriteCond %{HTTP_HOST} domain\.old$
RewriteRule (.*) http://domain.new/$1 [R=301,QSA,L]

所以这是从一个站点到另一个站点的完全重定向,它可以根据我的需要工作。 但是如何在没有文件 robots.txt 的情况下进行此重定向?我必须添加什么规则?

【问题讨论】:

    标签: regex apache .htaccess mod-rewrite redirect


    【解决方案1】:

    你可以为robots.txt破例:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} domain\.old$ [NC]
    RewriteRule ^((?!robots\.txt).*)$ http://domain.new/$1 [R=301,NC,NE,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-04
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多