黑客--网站Apache 全局配置(一次覆盖所有站点),禁止公共目录下的文件执行 仅限于阿帕奇服务器的情况把项目的public文件夹里的.htaccess文件替换为下面的内容就禁止了外部访问公共文件夹里的这些.php文件的执行了。就是黑客上传上来php执行文件后黑客不可以通过公共的这个路径地址再浏览器里执行这个文件。但是不可以避免在服务器内部执行这些文件这种就再想其他办法IfModule mod_rewrite.cRewriteEngine On #防 xxx.php.xxx 绕过 RewriteRule^(uploads|upfiles|hetong|ueditor)/.*\.php\.-[R403,L]#拦截脚本后缀兼容php、php3~php9、phtml RewriteRule^(uploads|upfiles|hetong|ueditor)/.*\.(ph(p[0-9]?|tml)|pht|phar|inc|asp|aspx|jsp|sh|cgi|pl|py)$-[R403,L]#上传目录截断不进TP路由 RewriteRule^(uploads|upfiles|hetong|ueditor)/-[L]#TP路由RewriteCond%{REQUEST_FILENAME}!-d RewriteCond%{REQUEST_FILENAME}!-f RewriteRule^(.*)$ index.php?s$1[QSA,PT,L]/IfModule#IfModule mod_rewrite.c#RewriteEngine On#RewriteBase/#RewriteRule^index\.php$-[L]#RewriteCond%{ENV:REDIRECT_STATUS}^$#RewriteCond%{REQUEST_FILENAME}!-f#RewriteCond%{REQUEST_FILENAME}!-d#RewriteRule./index.php[L]#/IfModule