2014-01-30 39 views
1

正常工作與1 GET2 PHP的.htaccess重寫規則GET變量

RewriteEngine On 
    RewriteRule ^store/([^/.]+)/?$ store.php?store=$1 [L,QSA]  

不工作時,我再添GET

RewriteEngine On 
    RewriteRule ^store/([^/.]+)/?$ store.php?store=$1&name=$2 [L,QSA] 

    localhost/store.php?store=3&name=abc 
    -> localhost/store/3/abc 

我有一個htaccess的重寫規則,它在1個GET工作正常,但我嘗試添加另一個GET,它不工作。

+0

再添進入它? – Eric

+0

定義$ 2的位置在哪裏?您只需創建1美元。 –

回答

1

你需要這樣的規則:

RewriteEngine On 

RewriteRule ^store/([^/.]+)/?$ store.php?store=$1 [L,QSA]  

RewriteRule ^store/([^/.]+)/([^/.]+)/?$ store.php?store=$1&name=$2 [L,QSA] 
0

也許

重寫規則^商店/([^/.]+)/名/([^/.]+)/?$ store.php?商店= $ 1 &名稱= $ 16 [L ,QSA]