使用mod_rewrite禁用显式get变量

时间:2015-04-19 16:40:11

标签: php apache .htaccess mod-rewrite

我正在使用Apache 2.4.9,mod_rewrite模块;这是我的.htaccess文件:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^pages pages.php [NC,L]
RewriteRule ^page/([0-9a-zA-Z]+)$ page.php?key=$1 [QSA,L,NC]

从底部重写规则,我可以访问page/test和我的页面输出test。但是,我仍然可以将?key=test2附加到网址,而页面会输出test2。有没有办法在重写规则的网址中禁用显式$_GET变量?

0 个答案:

没有答案
相关问题