Have you ever tried to access a website or online content, only to be met with the “403 Forbidden” error message? It’s super frustrating, right? You just want to do something simple like stream a movie or read an article, but this error is standing in your way.
So what does the “403 Forbidden” error actually mean? And how can you fix it? I can tell you it can be a real pain who has struggled with this error many times. But don’t worry; I’ve learned some helpful tips for troubleshooting it.
In this blog post, I’ll share my personal experience with the “403 Forbidden” error and give you some simple steps for fixing it.
What is Error 403 Forbidden?
If you’ve ever been denied access to a website, you may have received an HTTP 403 Forbidden error. This is an HTTP status code which means that the page or resource you were trying to access is blocked for some reason.
It could be that you don’t have permission to view the page, or your server understood the request but refuses to authorize it.
Consider it a sister to the ‘no trespassing’ sign, as it’s telling you that you don’t have permission to access this resource. If you see this error, it’s best to contact the website owner or administrator and ask for permission to access the page.
Causes of Error 403 Forbidden
Not only the above reasons but the error may also be caused by a variety of other factors, such as a misconfigured web server or a problem with the website’s content management system.
How to Fix Error 403 Forbidden?
Now I will explain how you can fix the 403 errors on your WordPress site. Although these methods mainly focus on WordPress, you can also use them on other sites. Let’s start with very beginner to advanced methods.
Fix the URL
The first and apparent reason you might have a 403 error forbidden is by putting a wrong URL. You might have set your website in a URL, but you are requesting a URL by spelling mistakes or another character.
Especially you might add ‘/’ or ‘\’ without knowing while setting up your URL and trying to access the link without it resulting in an error.
Fixing the URL with the correct characters can solve your site error.
Clear Site Cookies
If you face a 403 error after making a significant update on the site, it can result from caching. The site might work for a fresh browser or new user, but regular visitors can have errors.
Aside from Caching, cookies can return in error 403 if you visit a site frequently. So your WordPress site can also show 403 forbidden errors because of site cookies.
Clearing the site cookies is a simple process. All you need is to go to your browser’s settings, “Privacy and Security,” and “Clear Data,” and add cookies and caches.
When you visit the site, it should load the page without errors.
Scan with a security plugin
One of the reasons for having a 403 error on your site is malicious files in your site. These files can arise from any plugin or theme on your site. This malware can add new unnecessary files to your .htaccess File. So, even after editing your .htaccess File now and then, the issue can arise.
Scanning your site regularly is a good practice for site security. You can use plugins like Sucuri and Wordfence for scanning and keeping your site secure from the WordPress dashboard.
Most WordPress plugins can remove malware. Once the plugin finds all the files with problems, you can delete some with or without the premium features.
Deactivate CDN In Your Site
CDN or Content Delivery Network can help you to deliver content to distant visitors faster. You can make your site accessible with CDN when your main server is down. However, it can also result in 403 errors.
You can test your site by disabling the CDN temporarily. If you are using a third-party CDN, you can do it manually, or if your hosting provider adds the CDN to the package, contact support. Run the test till you find the problem and fix it.
Check Your Hotlink Protection
Check your hotlinks if you feel your CDN is not causing 403 errors. Hotlinking means embedding media file links directly from another source. It will reduce bandwidth use, but it will be considered theft if done without consent.
Your web hosting company might offer hotlink protection, but it can cause 403 errors forbidden in some cases. It is best to look into the matter yourself or take advice from a technical expert.
Disable All Plugins
If you have implemented all the above procedures yet couldn’t fix the error, you might need to disable the plugins. WordPress website returns error 403 now and then because of faulty code in the plugin.
Instead of disabling each plugin differently, I recommend disabling all of them for the first test. Let’s see how to disable all the plugins at once.
You can use the FTP account or the File Manager in your cPanel to disable all plugins. I will do it from the “File Manager.”
- Go to file manager
- Click on public_html
- Select wp-content
- Right-click and select rename
- Save settings after changing the plugins name
After changing, try to access the website. If it appears to load without error, you can log into the WP dashboard, but plugins won’t work.
You have to rename the folder “plugins” again to install or delete any plugin on your site. Add all the necessary plugins one by one to detect which plugin is causing the problem after identifying update the plugin or deleting it. You need to contact your hosting provider if you can’t solve the issue after that.
Check the Website Directory
If you create your site in the local directory and then upload it to the web server, you have to ensure the directory is correct. An empty directory can show an error 403 result, so ensure your content is loading from the correct directory.
Depending on the server, you should have your root directory in any of these:
- For Nginx: /var/www/vhosts/domain.com/httpdocs/
- For Apache: /home/username/public_html/
You must create one manually if you don’t see any of this directory.
Check A Record
Your website can show a 403 error because of the wrong IP address. Make sure your website is pointing to the correct IP address after installing. This can occur when you migrate hosting. Your domain can still point to older hosting, resulting in a 403 error forbidden.
You can create an A record for your domain from the zone editor. Head to your cPanel and find Zone Editor or DNS Editor. You should find it under Domains > Zone Editor.
Check if the IP address is pointing to the right host, and edit it manually if you see something wrong. If everything is okay, then your website should load perfectly.
Create a New .htaccess File
Sometimes all your files might be in perfect condition, but a simple issue in the .htaccess File can cause a 403 error. The only solution remains to fix the File, as it holds the maximum level of your website configuration.
If you don’t see the File in public_html, click the “Settings” button on the top left corner. Click on “Show hidden files” and then click save.
Before editing the .htaccess File, you must back up the existing File.
If you don’t see the File in public_html, then click the “Settings” button on the top left corner. Click on “Show hidden files” and then click save.
After saving it to your local directory:
- Delete the File from the root folder.
- Log into your WP dashboard and go to permalinks.
- Just click save changes without editing anything. This will create a new .htaccess file for your site.
The new File should remove any 403 error forbidden code your site previously had.
Add An Index Page
Your website should have an index.php or index.html page by default. Yet if your site is missing such a page, you must create a new one or redirect the page to the homepage. Upload an index page into public_html or rename it if you have an existing page.
- Log into your cPanel
- Right-click on .htaccess and click edit
- Add the code to the File
redirect /index.php /homepage.html
- Replace the “homepage.html” file name with your home page name.
Change File Permission
If none of the above methods are working, then your site might have issues with file permission. Each File is created with default permission, allowing you to read, write, or execute them.
There are usually 3 types of numeric values for permission:
- 755 for directories
- 644 for folders
- 700 for dynamic content
First, configure your site with an FTP client. Filezilla is a universal FTP client, but you can check if your hosting recommends any other software. In our case, I will show the screenshot from Core FTP LE.
First, right, click on the public_html File and click properties. In the Filezilla client, it would be named Attributes. Add 750 or 755 to this folder and click save.
Then click on the folder and look for wp-config.php. You need to right-click and select properties/attributes, keep everything as is and just put 644 or 640.
Save the configuration, and it should solve the 403 error forbidden issue.
This in-depth guide will help you to fix your 403 error effectively. You can understand how frustrating it can be as a visitor to encounter a 403 error. Also, as a webmaster, it can become a headache as you will lose a lot of potential traffic.
However, you can follow these beginners to advanced methods to fix the 403 error forbidden. I have covered all the possible causes and the solution for a 403 error. Still, if you need help fixing the problem, seeking professional help will be your last resort.