需要协助制作.htaccess更严格

时间:2015-08-31 05:04:41

标签: php apache .htaccess

我正在寻找帮助,使我的.htaccess文件指向我的index.php文件的所有请求,无论文件是否存在。目前,所有请求都发送到index.php,除非该目录中已存在该文件,我不想要,也不安全。

这是我目前的.htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*)$ /index.php?path=$1 [NC,L,QSA]

如果您有任何指针或资源,请告诉我。谢谢

2 个答案:

答案 0 :(得分:1)

试试这个

{{1}}

答案 1 :(得分:1)

您可以使用:

RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.+)$ index.php?path=$1 [L,QSA]

如果您需要path参数

中的真实路径
相关问题