繁体   English   中英

301重定向(如果url包含特定字符串)

[英]301 redirect if url contains specific string

在任何答案中都找不到,这就是为什么我要这样。

基本上,我需要301重定向URL,该URL中包含某些特定字符,但是是动态的。

特定字符为“ / l /”

例如:

 - example.com/l/test should 301 redirect to example.com/test
 - example.com/test/1/2/l/3 should 301 redirect to example.com/test/1/2/3

基本上,这意味着任何包含“ / l /”的网址都应该是相同的网址,但不能包含“ / l /”

限制:

 - /l/ can be anywhere in url.
 - url is dynamic

谢谢!

您可以在根.htaccess中使用此规则:

RedirectMatch 301 ^(.*?/)l/(.*)$ $1$2

暂无
暂无

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

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