我在使用这个正则表达式时遇到了问题,我认为它是正确的,但它不起作用。我想做的是重定向一堆包含特定字符串的网址,如下所示:
http://www.example.com/**undesired-string**_another-stringtohttp://www.example.com/**new-string**_another-string
和
http://www.example.com/folder/**undesired-string**/another-stringtohttp://www.example.com/folder/**new-string**/another-string
所以我在 .htaccess 中有这段代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule (.+)+(undesired-string)+(.+) $1new-string$2 [R=301,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
这应该将任何 url 中的任何不需要的字符串替换为新字符串,但它不起作用,知道为什么吗?
谢谢