What is 403 Forbidden Error?
The 403 Forbidden Error, denotes that the web page you are trying to reach is forbidden for access. This means that the webserver has received your request, but is unable to deliver it as you are unauthorized to access the page.
Any website that you visit on the internet sends a request to the webserver to process your request. The webserver in return sends back the pages, along with a http status code to the client (browser), which denotes the status of the request. A status code of 200 is received when the request is rightly processed. The end user does not see this status code as the request was successful and the pages have been displayed. However, when the webserver has understood your request, but due to some reason you are not allowed access to the page, it sends out a 403 Forbidden Error.
Few Forbidden Errors you might see:
- Forbidden – You don’t have permission to access / on this server
- 403 – Forbidden: Access is denied
- Error 403 – Forbidden
- 403 – Forbidden Error – You are not allowed to access this address
- 403 Forbidden – nginx
- HTTP Error 403 – Forbidden – You do not have permission to access the document or program you requested
- 403 Forbidden – Access to this resource on the server is denied
- 403. That’s an error. Your client does not have permission to get URL / from this server
- You are not authorized to view this page
- It appears you don’t have permission to access this page.
Causes of the Error?
The error code 403, is the webserver’s way of telling you that you do not have enough permission to access that page or that page is forbidden for you. The main reasons for getting this error are:
- Permission error: The permission of the files and folders are incorrect.
- Corrupted .htaccess: An incorrect setting in the .htaccess file.
How to fix 403 Forbidden Error?
As a website owner, if you get the 403, follow the below steps to do basic troubleshooting for this error:
STEP 1: If the 403 error is due to Permission Issue
One of the major reasons for 403 forbidden error is incorrect file permission that is stopping from processing the request. File permissions is the reason for almost 90% of the 403 errors.
When files are created, they come with default permission. These permissions control how you can read, write and execute these files. In most cases, directories should be having a permission 755 (-rwxr-xr-x) and files 755 (-rwxr-xr-x) or 644 (-rw-r–r–). Any file whose permission is wrongly set can be causing the error. See article to change permission of file.
Example: Directories should be 755. Executable scripts within the cgi-bin folder must be 755. Images, media, and text files like HTML should be 644.
STEP 2: If the 403 error is due to corrupted .htaccess file
If providing the right permission did not solve the issue, then check the .htaccess file. Rarely this could also be a cause for the 403 error, so its advisable to check the .htaccess, if the permission correction did not solve the error. Incorrect entry in the .htaccess file is also a reason for the error. The .htaccess file has a structure, which if disturbed, even a small typo or syntax error, can break your site.
To identify if the .htacess is causing the error, you can rename the file to .htacess_old and load the website. If the error is no longer present, then it shows that the. htacess was the issue. Always take a backup copy of your .htaccess file before making any changes. So that you can restore the backup file if the newly added one is corrupted. Also commenting the new line can help you identify if that is the cause. If you are unable to identify the broken line, then use online htaccess checker tools to check for any errors in your .htaccess file. Correct them or create a new .htaccess file and the error should be resolved.
Other probable causes for the error could be that, the website user is accessing an incorrect URL. It could be that he is accessing a hidden file or a folder, through the URL. This could also lead to forbidden error. Hence crosscheck the URL you are accessing. Also, if you have an index filename defined in your webserver configuration. But that index file is not created, then that also causes a 403 error.
A 403 forbidden error shows that your webserver is working fine. However, it is due to some access issue that the webserver is not delivering the request to the client(browser). Most 403 errors are caused due to permission issue. Follow the step defined above and you should be able to resolve the error. If the error still persists, reach out to your site administrator to investigate deeper and fix the error.