Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
.htaccess mod重写右标记_.htaccess_Mod Rewrite_Expression_Repeat - Fatal编程技术网

.htaccess mod重写右标记

.htaccess mod重写右标记,.htaccess,mod-rewrite,expression,repeat,.htaccess,Mod Rewrite,Expression,Repeat,我在.htaccess中有mod rewrite表达式 RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?lang=$1&cat=$2&ac=$3 [L] RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?start=$1&lang=$2&cat=$3&ac=$4 [L] Re

我在.htaccess中有mod rewrite表达式

RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?lang=$1&cat=$2&ac=$3 [L]
RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?start=$1&lang=$2&cat=$3&ac=$4 [L]
RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?lang=$1&cat=$2&bc=$3 [L]
RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?start=$1&lang=$2&cat=$3&bc=$4 [L]
RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?lang=$1&cat=$2&cc=$3 [L]
RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([a-z0-9]+)$ /index.php?start=$1&lang=$2&cat=$3&cc=$4 [L]
但由于相同(重复)条件(对于ac、bc、cc),链接的GET是错误的

我有这种解决方案,但不喜欢这样:

RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([x]+[0-9a-z]+)$ /index.php?lang=$1&cat=$2&ac=$3 [L]
RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([x]+[0-9a-z]+)$ /index.php?start=$1&lang=$2&cat=$3&ac=$4 [L]
RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([y]+[0-9a-z]+)$ /index.php?lang=$1&cat=$2&bc=$3 [L]
RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([y]+[0-9a-z]+)$ /index.php?start=$1&lang=$2&cat=$3&bc=$4 [L]
RewriteRule ^/?(am|ru|en)/([a-z]+|[0-9]+)/([z]+[0-9a-z]+)$ /index.php?lang=$1&cat=$2&cc=$3 [L]
RewriteRule ^/?([0-9]+)/(am|ru|en)/([a-z]+|[0-9]+)/([z]+[0-9a-z]+)$ /index.php?start=$1&lang=$2&cat=$3&cc=$4 [L]

什么是正确的解决方案。

当然,www.mysite.com/am/pr/ac,www.mysite.com/am/pr/ac,www.mysite.com/am/pr/bc,www.mysite.com/0/am/pr/bc,www.mysite.com/am/pr/cc,www.mysite.com/3/am/pr/cc最后一个解决方案:www.mysite.com/am/pr/xac,www.mysite.com/2/am/pr/xac,www.mysite.com/am/pr/ybc,www.mysite.com/0/am/pr/ybc、www.mysite.com/am/pr/zcc、www.mysite.com/3/am/pr/zccin代替ac、bc、cc可以是:红色、夏季、女性,例如衣服参数。所有这些都用于产品过滤。www.mysite.com/2/am/pr/blue/winter/formanI我不确定您的输入和预期输出是什么,但在第一组规则中,只有前两个规则匹配。在下面的每一对规则中,它们将尝试完全匹配相同的内容,但这将失败。让两条规则完全匹配同一件事,没有条件,通常不会起作用。。。只有第一个会适用。是的,我知道,但不能设定条件。显示您希望输入和预期输出是什么(即,用户请求的内容,以及服务器提供的内容),否则我们不知道您想要实现什么。