htaccess通配符重定向,但有异常

问题描述 投票:0回答:1

我目前正在使用下面的重定向规则。

RewriteEngine On

RewriteCond %{HTTP_HOST} ^domainexample.co.uk [OR]

RewriteCond %{HTTP_HOST} ^www.domainexmaple.co.uk

RewriteRule ^(.*)$ https://domainexamplenew.com/$1

我想添加一个例外。对于GSC html验证文件,例如googlee08e8ab5c95d7b8d.html - 只是无法让它工作

任何帮助/建议表示赞赏,

约翰

wordpress .htaccess
1个回答
0
投票

就像你在重定向中有无限循环。

您应该在条件和规则中使用相同的域名。

现在,当用户在domainexamplenew.com上打开页面时,它会一次又一次地重定向到domainexamplenew.com。

如果您想从domainexamplenew.co.uk重定向到domainexamplenew.com,那么您应该在条件中更改域。

例如

RewriteEngine On

RewriteCond %{HTTP_HOST} ^domainexample.com [OR]

RewriteCond %{HTTP_HOST} ^www.domainexmaple.com

RewriteRule ^(.*)$ https://domainexamplenew.com/$1
© www.soinside.com 2019 - 2024. All rights reserved.