Sometimes when we log in to certain websites, a 403 Forbidden error will pop up suddenly, causing the website to be unable to log in. Here is how to deal with this situation.
Methods to solve 403 forbidden errors:
1. Rebuild dns cache
For some common 403 forbidden errors, it is recommended that the first thing you try is to rebuild dns cache. Enter cmd, then enter ipconfig /flushdns. If that doesn't work, you need to parse the homepage in the hosts file.
2. Modify the folder security attributes
Use the following command to modify the folder security attributes
chcon -R -t httpd_user_content_t public_html/
Analysis of the command used:
ls -Z -d public_html/
3. About apache caused The solution to the 403 forbidden error
Open the apache configuration file httpd.conf and find this code:
Options FollowSymLinks AllowOverride None Order deny,allow Deny from all
Sometimes after configuring php, the "Deny from all" has rejected all connections. Change this line to "allow from all". The modified code is as follows, and the problem is solved.
Options FollowSymLinks AllowOverride None Order deny,allow Allow from all
4. Solution to 403 Forbidden error in HawkHost space
Sometimes Mod security is installed on the shared server, and when the URL contains other sensitive characters such as "%", , will be blocked by Mod security
How to solve HawkHost 403 Forbidden error:
Add the following code in the .htaccess file:
SecFilterEngine Off SecFilterScanPOST Off
Put it directly in the root directory of the website Or the directory where the program is running.
5. About the solution to the 403 Forbidden error caused by WordPress
For some blogs built using the WordPress management program, you need to modify the .htaccess file and add the following content at the end. , in fact, it is disable mod_security
SecFilterEngine Off SecFilterScanPOST Off
In addition, dedecms may need to add another one so that the default access is the DirectoryIndex index.html of the index.html file.
Modify the .htaccess file, upload the file, and then reopen the URL where 403 Forbidden appeared before and the error will no longer occur.
The above is the detailed content of How to solve the 403 error on the web page?. For more information, please follow other related articles on the PHP Chinese website!