The WordPress 403 forbidden error is a common error faced by WP users. If you are facing this issue with your site, there are some simple steps to follow to fix it. This is an HTTP status code that occurs when there is no permission for accessing a particular page or resources on your site. The underlying cause is incorrect configuration of the web server. It usually takes more time to identify the cause than fixing this error.
Causes of WordPress 403 Forbidden Error
As already mentioned, this error occurs when the server doesn’t offer permissions to access a particular page. Although this is the basic underlying cause, there are different scenarios how this error can occur. This includes:
- You can face this error when you are trying to access your WP login page
- The issue can arise when you are installing WordPress
- The error may occur when you migrate your website from another server
- It may occur when a page is accessed on your website
- The error may also be caused due to a WordPress plugin
- The error can also occur due to a corrupt .htaccess file
This guide helps you fix the WordPress 403 forbidden error based on the underlying cause.
1. WordPress Plugin Issue
If the 403 forbidden error is caused due to a plugin, follow these steps.
- Deactivate all the WordPress plugins
- If you notice that the problem no longer exists, it clearly indicates that the error was caused by one of the installed plugins
- Activate each plugin, one at a time
This can help you find which plugin was causing the error. You will also have to deactivate security plugins to be able to identify which plugin was causing the issue.
2. Error Due to .htaccess File Issue
It is likely that you may be facing the 403 forbidden error in your WordPress site due to a corrupt .htaccess file. It is easy to repair this file to fix the error. The steps involved are as following:
- Connect to your site through file manager from cPanel (or through an FTP client)
- Find the .htaccess file from within the root folder
- •Make sure to take a backup of the .htaccess file by downloading it to your computer system.
- Then delete the .htaccess file from the server and your WP site
- Access your WordPress website
- If the 403 forbidden error gets fixed, it means that the underlying cause was the a corrupt .htaccess file
Once you are certain that the error was caused due to corrupt .htaccess file, you should regenerate the file. The steps involved are as following:
- Log into your WP admin area
- Navigate to ‘settings’
- Then open ‘permalinks’ page
- Click on Save Changes (the option is available at the bottom of the page)
This will regenerate a new .htaccess file and will fix the 403 forbidden error for your WordPress site.
3. File Permission Errors
If you are unable to fix the error using the above-mentioned methods, it is most likely that the issue is due to improper file permissions. If the WordPress 403 forbidden error is caused by file permissions error, you should follow the steps given here.
Each file stored on your site WP site has file permissions. These permissions determine who has access to the files and folders. The forbidden error can occur when there are incorrect file permissions. This occurs when the web server perceives that you are trying to access files that you don’t have permissions for.
- Contact your WP hosting provider to check your site for proper file permissions (many web hosts can fix the issue without any objections)
- You can also make changes to the file permissions if you have the expertise (However, if you make the wrong changes, it can result in serious errors)
If you want to fix the 403 forbidden error in WordPress, you can follow these steps to check he file permissions:
- Connect to your WP site through an FTP client
- Access the root folder which contains all your WP files
- Right click on a folder and click on ‘file permissions’
- Set the root folder file permission to 744 or 755
- Choose the option ‘recurse into subdirectories’ (the option can be selected by clicking on the check box)
- Choose the option ‘apply to directories only’ (the option can be selected by clicking on the check box)
- Click on OK
The FTP client will set the permissions for all the subdirectories within the folder. The above-mentioned steps will have to be taken for each folder. However, for all the other files you will be using a different file permission. It will be 644 or 640. Make sure to check the boxes against:
- Recurse into subdirectories
- Apply to files only
Click on ‘ok’ and the FTP client sets up the file permissions for all the chosen files. Once you have set the permissions, access your WordPress website. You will no longer see the 403 forbidden error message again. If you need a more detailed guide on fixing the WordPress 403 forbidden, here is a great post from 000Webhost blog to help you.
Importance of WordPress Backup
Before you use the above-mentioned steps, make sure to take a complete backup of your WordPress site. The steps involved are as follows:
- Log into your server
- Access the root directory
- Use this command to have a full backup of your site: tar -cpzf wp-backup.tar.gz /var/www/html/wordpress/
- Also take a backup of your site’s database using the following command: mysqldump -u db_user -p db_name > wp_db_backup.sql
- You will need to provide your database password for taking this backup
- It will also be required to make changes to wp-user and wp-database along with your database user and name
So if you are facing the 403 forbidden error with WordPress, you should follow the above-mentioned steps to fix the problem. Make sure to take a backup of both your site and database. This will help you restore your website and all data if you make a mistake.