Nginx使用location
location ~ /(wp-content|uploads|wp-includes|images)/.*\.(php|php5|js)$ { deny all; }
Apache方法一(php_flag engine off #表示此目录下的PHP文件不被解释执行,限没有PHP权限)
<Directory /uploads/test>
php_flag engine off
</Directory>
Apache方法二(文件目录自己设置)
<Directory ~ "^/uploads/test/.*">
<Files ~ ".php|php5">
Order allow,deny
Deny from all
</Files>
</Directory>