我在 .htaccess 中有 mod 重写表达式
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]
什么是正确的解决方案。