简体   繁体   English

htaccess通配符重定向,异常

[英]htaccess wildcard redirect with an exception

I'm currently using below redirect rules. 我目前正在使用以下重定向规则。

RewriteEngine On

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

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

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

I'd like to add an exception in. For a GSC html verification file eg googlee08e8ab5c95d7b8d.html - just can't get it work 我想在其中添加一个例外。对于GSC html验证文件,例如googlee08e8ab5c95d7b8d.html-只是无法正常工作

Any help/suggestions are appreciated, 任何帮助/建议表示赞赏,

John 约翰

There is like you have infinite loop in redirects. 好像您在重定向中存在无限循环。

You should use same domain name in conditions and in rule. 您应在条件和规则中使用相同的域名。

Now when user open page on domainexamplenew.com then it redirect to domainexamplenew.com and again and again. 现在,当用户在domainexamplenew.com上打开页面时,它将一次又一次地重定向到domainexamplenew.com。

If you want redirect from domainexamplenew.co.uk to domainexamplenew.com then you should change domain in conditions. 如果要从domainexamplenew.co.uk重定向到domainexamplenew.com,则应更改条件的域。

For example 例如

RewriteEngine On

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

RewriteCond %{HTTP_HOST} ^www.domainexmaple.com

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM