我有這樣的規則,在我的.htaccess的.htaccess重寫規則不讀的最後兩個參數
RewriteRule ^clothes/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ products.php?g=$1&$2=$3&$4=$5&$6=$7&$8=$9&$10=$11 [L]
RewriteRule ^clothes/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ products.php?g=$1&$2=$3&$4=$5&$6=$7&$8=$9 [L]
RewriteRule ^clothes/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ products.php?g=$1&$2=$3&$4=$5&$6=$7 [L]
RewriteRule ^clothes/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ products.php?g=$1&$2=$3&$4=$5 [L]
RewriteRule ^clothes/([^/]+)/([^/]+)/([^/]+)/?$ products.php?g=$1&$2=$3 [L]
RewriteRule ^clothes/([^/]+)/?$ products.php?g=$1 [L]
它可以像website.com/clothes/women/type/tshirts/brand/nike/color/red/size/s/price/0-29
,這應該是print_r($_GET)
Array
(
[g] => women
[type] => tshirts
[color] => red
[brand] => nike
[size] => s
[prezzo] => 0-29
)
於是開始from website.com/clothes/women/
然後我可以添加過濾器/值對,然後到達可以使用所有可能的過濾器的地址。
的問題是,最後一個過濾器/值對不工作,從第一條規則這個片段在.htaccess [..]&$10=$11
。因此,而不是aspected轉儲的數據,我得到這個
Array
(
[g] => women
[type] => tshirts
[color] => red
[brand] => nike
[size] => s
[women0] => women1
)
所以基本上它取代了最後一個過濾器/值對第一濾波器,g=$1
的名稱。
有多少個參數可以傳入url
的參數.htaccess是否有限制?在我看來,最後一個參數是$9
,所以$10
沒有考慮在內。
如果是這樣,我可以解決這個問題嗎?
謝謝。
您只能使用'$ 0到$ 9'捕獲的組。 – anubhava
謝謝,這就是我的想法。 –