我有此规则可以重定向除包含/ amp /:的URL以外的所有内容
REGEX :
big-brother(?s)((?!\/amp\/).)*$
仅在URL中包含/ amp /的情况下,重定向的规则如何?
答案 0 :(得分:0)
如果您希望从类似于以下网址的URL重定向:
http://some_domain/some_url/big-brother/amp/others
https://some_domain/some_url/big-brother/amp/others
http://www.some_domain/some_url/big-brothers/amp/others
https://www.some_domain/some_url/big-brothers/amp/others
至:
http://some_domain/some_url/big-brother/others
https://some_domain/some_url/big-brother/others
http://www.some_domain/some_url/big-brothers/others
https://www.some_domain/some_url/big-brothers/others
这可能有效:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} (.*)\/amp(.*) [NC]
RewriteRule (.*)(big-brothers?)(\/amp\/)(.*) $1$2/$4 [L,R=301]
</IfModule>
如果没有,则可以在regex101.com中设计/修改/更改表达式。
您可以在htaccess.madewithlove.be中测试/修改RewriteRules。