How to ban php in apache: first create a new ".htaccess" file; then copy the code content "
Order allow,deny " to the ".htaccess" file; finally, copy the file directly Just put it in the root directory of the website.
How to configure apache to configure the upload directory to prohibit running php
Security protection There are many security issues caused by the website upload function , have you taken safety precautions?
Introduction: Prohibiting the uploading directory from running executable files such as php can increase the security of the website to a certain extent. The method of prohibiting the uploading directory from running php can use the .htaccess file, or you can modify the configuration directly on the apache server. File.
The first method to prohibit the upload directory from running php
If you use a virtual space, you can use the .htaccess file to restrict the upload directory from running php.
.htaccess method A
Create a new .htaccess file, copy the following content, and upload it to the folder where you want to prohibit running php
<Files ~ ".php"> Order allow,deny Deny from all </Files>
.htaccess method B
Put it directly into the root directory of the website to limit multiple directories:
RewriteEngine on RewriteCond % !^$ RewriteRule uploads/(.*).(php)$ – [F] RewriteRule data/(.*).(php)$ – [F] RewriteRule templets/(.*).(php)$ –[F]
Second method: Modify the Apache configuration file
Add the following content to the configuration:
"> <Files ~ ".php"> Order allow,deny Deny from all </Files>
Many For relevant knowledge, please visit PHP中文网!
The above is the detailed content of How to set apache to disable php. For more information, please follow other related articles on the PHP Chinese website!