0
我在我的管理系統有一個網頁以下路徑:
我想,使之指向重寫它:
http://192.168.1.253/xxxxxx/admin/view/news-items.php?issue=3
然而,我似乎無法讓它工作,因爲頁面顯示,但php無法檢測$ _GET變量。我有2個.htaccess文件,一個在xxxxxx目錄中,另一個在admin目錄中。在這裏,他們是:
XXXXXX:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^([^/.]+)/delete/(1-9)/?$ $1.php?delete=$2 [L]
RewriteRule ^([^/.]+)/?$ $1.php [L] # rewrite without query string parameters
RewriteRule ^([^/.]+)/([^/.]+)/?$ $1.php\#$2 [L] # one name string parameter
管理:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^([^/.]+)/?$ $1.php [L] # rewrite without query string parameters
RewriteRule ^([^/.]+)/(\d+)/?$ $1.php?id=$2 [L] # one id parameter
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/issue/(\d+)/?$ $1.php?issue=$2 [L] # one issue parameter
RewriteRule ^([^/.]+)/(\d+)/(\d+)/?$ $1.php?id=$2&file_id=$3 [L] # two parameters
編輯
這是新代碼:
XXXXXX:
RewriteEngine On # Turn on the rewriting engine
#RewriteRule ^([^/.]+)/delete/(\d+)/?$ $1.php?delete=$2 [L,QSA]
RewriteRule ^([^/.]+)/?$ $1.php [L,QSA] # rewrite without query string parameters
RewriteRule ^([^/.]+)/([^/.]+)/?$ $1.php\#$2 [L,QSA] # one name string parameter
管理:
RewriteEngine On # Turn on the rewriting engine
#RewriteRule ^([^/.]+)/?$ $1.php [L,QSA] # rewrite without query string parameters
#RewriteRule ^([^/.]+)/(\d+)/?$ $1.php?id=$2 [L,QSA] # one id parameter
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/issue/(\d+)/?$ $1.php?issue=$2 [L,QSA] # one issue parameter
RewriteRule ^([^/.]+)/(\d+)/(\d+)/?$ $1.php?id=$2&file_id=$3 [L,QSA] # two parameters
它仍然在做同樣的事情,之前我加入了QSA後,每個規則:/。請參閱上文。 – 2012-04-12 14:13:46
@Phil請將',R = 302'添加到標誌 - 這將做臨時重定向 - 以便您將在瀏覽器地址欄中看到重寫的URL。如果它被正確地重寫了,但你仍然無法獲得這些變量,那麼它可能是其他地方的另一個規則......或者你的PHP腳本中的一些代碼(可能是其他原因,這兩個比較可能)。 – LazyOne 2012-04-12 15:26:14