Mod rewrite 条件重写规则重定向
我有一个基本规则如下:Mod rewrite 条件重写规则重定向,mod-rewrite,Mod Rewrite,我有一个基本规则如下: RewriteRule ^facial-moisturizer-spf-15.html /kyoku-facial-moisturizer-spf-15.html [R=301,L] 这对于1-2-1重定向很好,但我必须重定向这两个: /面部润肤霜-spf-15.html /保湿霜/面部润肤霜-spf-15.html 有没有一种方法可以在一行中完成,而不是求助于重写条件 谢谢完全未经测试,但: RewriteRule ^(moisturisers/)?facial-mo
RewriteRule ^facial-moisturizer-spf-15.html /kyoku-facial-moisturizer-spf-15.html [R=301,L]
这对于1-2-1重定向很好,但我必须重定向这两个:
/面部润肤霜-spf-15.html
/保湿霜/面部润肤霜-spf-15.html
有没有一种方法可以在一行中完成,而不是求助于重写条件
谢谢完全未经测试,但:
RewriteRule ^(moisturisers/)?facial-moisturizer-spf-15.html /kyoku-facial-moisturizer-spf-15.html [R=301,L]
谢谢-我们不知道前一段是什么-将尝试使用通配符,然后类似于
RewriteRule(facial \-weather \-spf \-15\.html)$/kyoku-$1[R=301,L]
(同样,未经测试,仅在我的头顶上)的东西怎么样?谢谢,不幸的是,这产生了一个循环。现在修补这是对的,我想你可以添加一个RewriteCond
来避免循环(RewriteCond%{IS_SUBREQ}false
),但是,如果你原来的问题是试图避免RewriteCond
,那么这可能对你不起作用。我想这是一个开始:-)