Security Protection site upload function caused a lot of security problems, you do a good job of security?
Introduction: Prohibit the upload directory to run PHP and other executable files can increase the security of the site to a certain extent, prohibit the upload directory to run PHP method can use the. htaccess file, you can also directly modify the configuration file on the Apache server.
The first way to disallow uploading a directory to run PHP
If you use a virtual space you can use the. htaccess file to restrict the upload directory to run PHP.
. htaccess method A Create a new. htaccess file, copy the following, and upload it to a folder in which you want to disable PHP
- <files ~ ". php" >
- Order Allow,deny
- Deny from all
- </Files>
. htaccess Method B
Restrict multiple directories directly to the Web site root:
- Rewriteengine on Rewritecond%!^$
- Rewriterule uploads/(. *). (PHP) $–[f]
- Rewriterule data/(. *). (PHP) $–[f]
- Rewriterule templets/(. *). (PHP) $–[f]
The second method: Modify the Apache configuration file configuration by adding the following:
- <directory "<your_dir>" >
- <files ~ ". php" >
- Order Allow,deny
- Deny from all
- </Files>
- </Directory>
Apache Configuration upload directory prohibit the way to run PHP