2017-02-27 91 views
0

我有一個htaccess的,如:

RewriteEngine On 
RewriteRule  ^admin/$        admin/index.php     [NC,L] # Handle product requests 
RewriteRule  ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$  index.php?p=$1&id=$2    [NC,L] # Handle product requests 
RewriteRule  ^([a-zA-Z0-9-]+)/?$      index.php?p=$1     [NC,L] # Handle product requests 
RewriteRule  ^$          index.php?p=index 

但是,當我得到這樣的URL: site-mine.php/product/?soomething=anything 那麼PHP只能實現product$_GET參數。 我想獲取全部$_GET參數。 可以幫助我嗎? 感謝

回答

2

要通過原來的查詢參數的重寫URL,你需要的QSA flag

RewriteRule  ^admin/$ admin/index.php  [NC,L,QSA] # Handle product requests 
                 ^^^ here 
# etc. 
+0

謝謝你給我的鏈接。我讀了一些教程,但仍然無法正常工作。 – Hanata

1

使用Query String Append選項

更換

index.php?p=$1 [NC,L]

index.php?p=$1 [QSA,L] 

您可以訪問GET變量爲$_GET["p"]

存在QSA,L之間沒有空格。 [QSA,L]