最近有客户反映模板目录文件可以被直接访问到,问题只需要添加伪静态规则即可解决:
1、htaccess
#禁止指定脚本的运行
RewriteCond % !^$
RewriteRule template/(.*).(php|php3|php4|php5|php6|php7|pht|phtml|asp|aspx|jsp|exe|perl|cgi|asa|html)$ – [F]
RewriteRule uploads/(.*).(php|php3|php4|php5|php6|php7|pht|phtml|asp|aspx|jsp|exe|js|perl|cgi|asa|html)$ – [F]
2、nginx
location ~ template/(.*).(php|php3|php4|php5|php6|php7|pht|phtml|asp|aspx|jsp|exe|perl|cgi|asa|htm|html)$ {
return 403;
}
location ~ uploads/(.*).(php|php3|php4|php5|php6|php7|pht|phtml|asp|aspx|jsp|exe|js|perl|cgi|asa|htm|html)$ {
return 403;
}
微信扫一扫
开发者为您服务