.htaccess 拒绝访问index.php,但允许index.php?var=val
我想知道我是否可以拒绝访问,只允许访问 使用rewritecond和rewriterule可以这样做吗?我想不出来。有什么帮助吗.htaccess 拒绝访问index.php,但允许index.php?var=val,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我想知道我是否可以拒绝访问,只允许访问 使用rewritecond和rewriterule可以这样做吗?我想不出来。有什么帮助吗 谢谢 它必须是重写规则吗?如果是PHP脚本,您可以检测到缺少必需的参数,只需返回一个适当的HTTP头来拒绝访问。是的,这是可能的。在docroot.htaccess文件中使用条件检查查询字符串的技巧,该文件允许您禁止访问index.php,除非设置了变量var: RewriteEngine On RewriteBase / RewriteCond %{
谢谢 它必须是重写规则吗?如果是PHP脚本,您可以检测到缺少必需的参数,只需返回一个适当的HTTP头来拒绝访问。是的,这是可能的。在docroot
.htaccess
文件中使用条件检查查询字符串的技巧,该文件允许您禁止访问index.php,除非设置了变量var:
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} !\bvar=
RewriteRule index.php - [F]
谢谢你的回复!是的,它应该是.htaccess,因为index.php脚本是经过编码的,我无法修改它。