Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mod rewrite 条件重写规则重定向_Mod Rewrite - Fatal编程技术网

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
,那么这可能对你不起作用。我想这是一个开始:-)