Fix 403 Forbidden Error in WordPress: Is your website getting affected by the 403 Forbidden Error? If yes, then we have got the right solutions in this article for you.
Here, you find quick fixes that will easily remove the error while visiting any page. Stay gripped by this article as you will know some easy methods to resolve this issue. Along with this, you will be acknowledged by what is 403 Forbidden error and its causes.
What is 403 Forbidden Error in WordPress? Fix 403 Forbidden Error in WordPress
It is common to have such annoying errors whenever you enter any website. This may not happen every time but it can occur when the user requests any forbidden page. It will show a dialogue box with an HTTP status code indicating a permission error.
Causes of occurring 403 Forbidden Error in WordPress
403 Forbidden Error in WordPress is one of the most irritating errors for the users visiting your website. Users may instantly press the back button and leave your website. While this should not happen, you must know the reasons for facing such errors before heading to the solution:
- Most commonly, this error can occur because of the poor configuration of security plugins. It will result in malicious content and then a 403 forbidden error.
- Also, incorrect file and folder permissions sometimes are the cause of such errors on your website.
- Another cause is the inappropriate settings of the “.htaccess” file on your website.
- An incorrect IP address pointed to the domain can be a cause of 403 forbidden error.
- Or sometimes, it may happen that the updated page may not be the same as the cached page data. And it may give rise to the 403 forbidden error.
Techniques to Fix 403 Forbidden Error in WordPress
- Checking the .htaccess file
- Resetting the directory and file permissions
- Clearing the browser cache
- Disable Plugins
- Uploading an Index Page
- Edit File Ownership
- Verify the A record
- Scan for Malware
Checking the “.htaccess” file
Staying in the backend bars, the “.htaccess” file remains unnoticed every time. By default, you will find this file on most websites. If not present, you will need to create this file manually.
If already present on the website, it often creates issues if it gets corrupt. And ultimately, it will give rise to the 403 Forbidden Error in WordPress. But thankfully, it can be fixed using the below steps:
- Firstly, you must connect your site with the File Manager in cPanel.
- In the file manager tab, find the public_html directory and then reach the .htaccess file. If you cannot find the “.htaccess” file, then visit the settings tab by enabling the Show Hidden Files option.
- When you find the file, you simply need to right-click on the file and tap the Download option. It will generate a backup of the file.
- After the backup is created, immediately delete the file. After deletion, check whether the website works correctly. If it does, know that the “.htaccess” file was corrupt.
- After deleting the old “.htaccess” file, you must create a fresh one. For this, visit the WordPress dashboard and tap the Permalinks option under the Settings tab.
- Lastly, tap the Save button to store the changes.
Resetting the directory and file permissions
- Another possible cause that causes the occurrence of 403 Forbidden Error is the incorrect file permissions. The files stored on the website can sometimes enable some unwanted permissions. And eventually, it may rise to have 403 Forbidden Error in WordPress.
- This can be solved by using the FTP client letting you edit the file and folder permissions.
- For this, you need first to connect your website to an FTP client.
- Next, you need to reach the root folder containing all WordPress files.
- Once reached, simply right-click to choose a folder and then select the File permissions option.
- The FTP client will then take you to the permissions box.
- Ensure all the folders in the website have the file permission of 744 to 755.
- While all the files on the website should have a file permission of 644 to 640.
- You can simply apply permission for the folders if any changes are required. Next, you need to check the option in front of the “Recurse into subdirectories” as “Apply to Directories only”.
- Then, tap the OK button and this will apply to all the directories in the folders.
- The same process will be applied to the files to enable file permissions. But for the files, you need to set the file permissions from 644 to 640.
- After resetting the file permissions, you can now visit the website to check whether the error appears or not.
Clearing the Browser Cache
- Caching is all about storing the data and utilizing it when requested again. This is eventually a faster process as the request will not be sent to the server every time. It will directly access the cached data and the page will load faster. However, the user may update their web pages often and the cached data will differ from the actual page. And this will be an occurrence of 403 Forbidden error while loading the page.
- Not only caching but, cookies can also form this error while loading any page you normally use. It may happen that the page you always used to log in will show this 403 Forbidden error. To solve this, you must clear the cache and cookies on the browser.
- On your current browser, reach the Settings tab by tapping the three dots icon.
- Then reach the Privacy and Security option and tap Clear Browsing Data.
- You can select the time of clearing the data. Then choose which cached data is to be cleared.
- After choosing, tap the Clear Data button and this will clear the cache.
Following the above three methods, if the error still occurs then the reason should be incorrect plugins. Or the excess amount of plugins may create tension while loading any page.
So, we recommend disabling all the plugins at the same time instead of doing them one by one. But first, we will detect the plugins which are having issues by the below steps:
- Visit your Hosting account’s file manager and then navigate the public_html.
- Next, click on the wp_content folder and find the Plugins folder.
- You need to rename this folder to the Disable Folder name to disable all the plugins.
- Now, you have to head back to the browser and check whether the site is working. If yes, then the plugins were creating obstacles.
- Now, rename the Disabled plugin folder name to the original one.
- Once done, go back to the WordPress dashboard and visit the Installed Plugins page. On the page, you need to deactivate all the installed plugins one by one to avoid errors.
Edit File Ownership
This method is for those who use Linux or the VPS web hosting service. Sometimes, incorrect file ownership can be a cause of having a 403 Forbidden error. This should not happen as all files and folders should be assigned to the owner or a secured group.
And if the error is occurring, you need to check for the file ownership. And for this, you must have SSH access along with the SSH terminal connecting to the VPS.
Once, you have these, you can simply check the file ownership using the below SSH command:
ls -1[file name]
This will show the result like this:
-rwxrw-rw- 1 [owner][group] 26 Jul 23 2:45 filename.txt
You need to look for the owner part in the above code. The correct name should be your hosting provider’s username. In case, it does not have, you need to modify it by taking help from the hosting support team.
Verify the A Record
The domain name always points to the IP address that recognizes the device and gives access to the website. Sometimes, it happens that the domain name points to the wrong IP address. Ultimately, this will give rise to the 403 Forbidden error when you load a page. Therefore, it is vital to check whether the domain is pointing to the correct IP.
For this, you’ll need the A record that helps in checking whether the domain is pointed to the correct IP:
- Visit the hPanel and then tap the Advanced section to reach the DNS zone editor.
- Here, you will find a list of DNS records and you have to search for the A record in the type column.
- Once found, you need to check whether it is pointed to the right IP address. Analyze the content column and find your IP.
- If it is incorrect, simply tap the Edit link to enter the right IP. Once done, tap the Update button and that’s it.
Scan for Malware
- Malware can be a big cause for the 403 Forbidden error in WordPress. If it enters your website, it will keep shooting up the “.htaccess” file with harmful codes.
- And even if you try all the methods above, it will not be resolved and keep showing the error.
- To ultimately fix this, you need to have security scans on your website. And WordPress offers various security plugins like Sucuri and Wordfence to do this.
So, this is how we have made it easier for you to know how to fix the 403 Forbidden error in WordPress Themes. Also, we have mentioned what is 403 Forbidden error and the causes of such issues. I hope the above article was enough understandable for you.