我的.htaccess
中有这个RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8&i=$9&j=$10&k=$11&l=$12&m=$13 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8&i=$9&j=$10&k=$11&l=$12 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8&i=$9&j=$10&k=$11 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8&i=$9&j=$10 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8&i=$9 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3&d=$4 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)$ index.php?a=$1&b=$2&c=$3 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ index.php?a=$1&b=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?a=$1 [QSA,L]
它的作用是重写类似的东西:
到
但当我var_dump
时,它会显示:
array(12) {
["a"]=>
string(8) "moderate"
["b"]=>
string(8) "overview"
["c"]=>
string(2) "29"
["d"]=>
string(9) "stoptober"
["e"]=>
string(4) "page"
["f"]=>
string(1) "1"
["g"]=>
string(6) "filter"
["h"]=>
string(10) "no-twitter"
["i"]=>
string(12) "no-instagram"
["j"]=>
string(9) "moderate0"
["k"]=>
string(9) "moderate1"
["l"]=>
string(9) "moderate2"
}
这怎么可能?更重要的是,我该如何解决这个问题?
答案 0 :(得分:1)
Backreferences
介于$0
和$9
之间。
如果您尝试$10
,则$1
与0
结尾,moderate0
($1
= moderate
) 。
解决方案:你需要减少你的参数。这是一个uri设计问题
编辑:如果您想避免重复条件,可以按照以下步骤进行操作
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# all your RewriteRule here
答案 1 :(得分:0)
试试这个..这将按照你想要的方式工作..你可以根据你的要求更改链接名称......
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -Indexes
RewriteEngine On
RewriteRule ^([^/]*)/$ index.php?select=$1 [L]
RewriteRule ^([^/]*)/$ ?select=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?select=$1&a=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ index.php?select=$1&a=$2&b=$3 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/$ index.php?select=$1&a=$2&b=$3&c=$4 [L]
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>