How to fix the 403 forbidden error in WordPress?

In this article, we will show you how to easily fix the 403 forbidden error in WordPress.

What is a 403 Forbidden – Access Denied Error in WordPress?

403 Forbidden error code is shown when your server permissions don’t allow access to a specific page.

This is why the error is usually accompanied by the text:

403 Forbidden – You don’t have permission to access ‘/’ on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

There are different scenarios when you can see this error. For example:

  • 403 Forbidden – Access denied on wp-admin or WordPress login page.
  • 403 Forbidden – during WordPress install.
  • 403 Forbidden error when visiting any page on your WordPress site.
  • It is also possible that you only get to see ‘Access Denied’ instead of full 403 Forbidden status.
  • You may also see ‘Access to yourdomain.com was denied. You don’t have authorization to view this page.’

Now that you know about the different types of 403 errors, let’s talk about what causes this error.

 

What Causes 403 Forbidden Error in WordPress?


The most common cause for the 403 Forbidden error in WordPress is due to a corrupt .htaccess file or incorrect file permissions on your server.

Another possible cause could be poorly configured security plugins. Many WordPress security plugins can block an IP address (or a whole range of IP addresses) if they believe them to be malicious.

This is why we use Sucuri to improve security of all our WordPress sites.

Changes to server/PHP settings may also result in 403 Forbidden error on your site.


Fixing 403 Forbidden Error in WordPress

Before you do anything, we recommend that you create a complete WordPress backup of your website. Make sure that you have downloaded the backup to a safe place and you have access to the backup before moving forward.

 

1. Fix 403 Forbidden Error Caused by File Permissions in WordPress


All files stored on your website have file permissions. These file permissions control who can access files and folders on your website.

Incorrect file permissions can cause 403 forbidden error. It makes your web server thinks that you do not have permission to access those files.

Changing file permissions yourself can have serious consequences. If you want to do it yourself, then here is how you would check your file permissions.

Simply connect to your WordPress site using an FTP client or open File Manager from your cPanel home. Navigate to the root folder (public_html) containing all your WordPress files.

Click to select a folder, right click and then select File Permissions from the menu.

Your FTP client/File Manager will show you a file permissions dialog box.

All folders on your WordPress site should have a file permission of 744 or 755.

All files on your WordPress site should have a file permission of 644 or 640.

You can set the file permission to the root folder to 744 or 755. Check the box next to ‘Recurse into subdirectories’ and then check the option that says ‘apply to directories only’.

Click on the OK button. Your FTP client/File Manager will now start setting permissions to all subdirectories in that folder.

Once it is done, you need to repeat the process for all the files. This time you will use file permission of 644 or 640 and don’t forget to select ‘Recurse into subdirectories’ and ‘apply to files only’. options.

Click on the OK button and your FTP client/File Manager will start setting file permissions for all the selected files.

 

2. Fix 403 Forbidden Error Caused by Corrupt .htaccess File


Often the 403 error is caused by a corrupt .htaccess file in your WordPress site. Repairing this file is quite easy.

First you need to connect to your website using a FTP client or file manager in cPanel.

Next, locate the .htaccess file in the root folder of your WordPress site. See this guide if you can’t find .htaccess file in Your WordPress folder.

You need to download the .htaccess file to your computer so that you have a fresh backup of it. After that, you need to delete the file from your server.

Try accessing your website. If 403 forbidden error is resolved, then this means that your .htaccess file was corrupt.

You can generate a fresh .htaccess file by logging into your WordPress admin area and going to Settings » Permalinks page.

Simply click on the Save Changes button at the bottom of the page and WordPress will generate a fresh .htaccess file.

 

3. Fixing 403 Forbidden Error Caused by a WordPress Plugin


First thing you need to do is to temporarily deactivate all WordPress plugins. This includes any security plugins that you may have installed on your site.

If this resolves your problem, then this means one of the plugins on your website was causing this error.

You can figure out which plugin was causing the error by activating all your plugins one at a time until you are able to reproduce the 403 forbidden error.

Try accessing your website now, and 403 forbidden error should be gone now.

We hope this article helped you fix the 403 forbidden error in WordPress.

  • 279 Users Found This Useful
Was this answer helpful?

Related Articles

How to reset or regenerate the .htaccess file in WordPress?

A [.htaccess] file is a configuration file that tells your server how to handle certain things on...

How to deactivate plugins when not able to access WordPress admin?

Often during troubleshooting, you may need to deactivate all plugins and activate them one by...

Fix incorrect PHP handler or session path

  Server software and configuration can vary from provider to provider, which in turn causes...

How to fix errors after migrating WordPress?

  Migrations from cPanel-based servers are usually seamless. But sometimes, a few issues might...

Fix missing MySQL extension or PHP extension or session error

  The most common reason for the error is using an invalid PHP handler/directive in the...