php $ _GET无法使用干净的网址

时间:2015-01-15 17:19:35

标签: php .htaccess clean-urls

我有以下.htaccess

ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
Header unset ETag
FileETag None

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+edit-rsps\.php\?server=([^\s&]+) [NC]
RewriteRule ^ edit-rsps/%1? [R=301,L]

RewriteRule ^edit-rsps/([^/]+)/?$ edit-rsps.php?server=$1 [L,QSA]

现在当我尝试输出$ _GET ['server']时,我得到一个空结果。我是php的新手,所以感谢任何帮助...

1 个答案:

答案 0 :(得分:0)

尝试删除此行:

RewriteRule ^ edit-rsps/%1? [R=301,L]

编辑:

ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
Header unset ETag
FileETag None

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^edit-rsps/([^/]+)/$ edit-rsps.php?server=$1 [L]

你的网址应该是

/edit-rsps/server-var/