我的管理系统中有一个页面,路径如下:
我正在尝试重写它,以便它指向:
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