WordPress 403 Forbidden Error: Why It Happens and How to Fix It
WordPress troubleshooting

WordPress 403 Forbidden Error: Why It Happens and How to Fix It

A 403 error, usually shown as 403 Forbidden, means the server received the request and understood it, but refuses to give access to the resource. The site didn’t crash, and this isn’t a total white screen of death either. Something along the way, in the server, a firewall or the permission settings, decided to block the request.

That is why the fix differs from a message like Error Establishing a Database Connection. You aren’t looking for a broken plugin, you are looking for whoever is blocking: a rule in the .htaccess file, wrong file permissions, a security plugin, or the firewall of the server or Cloudflare. Below I’ve put the checks in order, and for each one I explain how to recognize the cause and how to fix it. If you landed here searching for a wordpress 403 forbidden error fix, start at step 1.

Before any change, back up all your files and the database. The official WordPress documentation asks you to make sure you have a backup or a staging environment before touching a site, and some of the steps here change files and permissions.

Step 1: find out who is returning the 403 error

The first clue is in the error page itself. According to Cloudflare’s documentation, if the site goes through Cloudflare and the error page doesn’t carry their branding, the error comes directly from the hosting server. If it carries Cloudflare branding, the block happened on their side.

A few more questions help narrow the search:

  • Does the error appear across the whole site, or only at a specific address such as /wp-admin or wp-login.php?
  • Does it appear for everyone, or only for you, from a certain network or a certain device? An IP address block looks exactly like this.
  • What changed recently: a new plugin, an update, a server move, a change in Cloudflare?

Before touching files, rule out the simple things: check that the address you typed is correct, try a private browsing window, and try another network, for example your phone with Wi-Fi turned off. If the error disappears on another network, suspect an IP address block.

If the block is at Cloudflare, you can skip to step 5. If it comes from the server, continue to step 2.

Step 2: access rules in the .htaccess file

On Apache servers the .htaccess file can contain access rules, and Cloudflare also lists permission rules in this file as one of the common causes of a block from the server side. Such rules are sometimes added by security plugins, or manually to protect certain folders.

To check whether the file is the problem:

  1. In FTP or the file manager, go to the site’s root folder and rename the .htaccess file to .htaccess_old. In many FTP programs, files that start with a dot are hidden, and you may need to turn on showing hidden files.
  2. Load the site. If the error is gone, the problem is in the file.
  3. Go to Settings > Permalinks and click Save Changes, so WordPress creates a new file. If you see the message “You should update your .htaccess now.”, manually copy the rules shown at the bottom of the screen.
  4. If the old file had rules you need, add them back one at a time and test after each. The rule that breaks access is the one after which the error returns.

If the error appears only on a specific path, also check .htaccess files in subfolders, for example inside wp-content or wp-content/uploads.

Step 3: file and folder permissions

Suspicion moves to permissions when the error started after moving a site, uploading files manually or restoring from a backup, and appears only on certain files or folders. In FTP or the file manager you can see the permissions of every file and folder.

The WordPress documentation on file permissions recommends these settings on servers that run PHP under your own user (suexec):

What Recommended permission
Folders 755 or 750
Files 644 or 640
wp-config.php 440 or 400

What you shouldn’t do is solve the block by setting permission 777. The documentation warns that this permission lets anyone who manages to upload or change a file take full control of the site. If you aren’t sure what the correct setting is on your server, you can ask your hosting company’s support to reset the permissions.

Before changing permissions, write down what the previous settings were. After the change, load the blocked address again. If the error stays exactly as it was, the permissions were probably not the problem, so move on to the next step.

Step 4: a security plugin that blocks

A security plugin can block requests, for example by IP address. It is the main suspect when the block appears after installing or updating such a plugin, after several failed login attempts, or only from a specific IP address.

There are a few ways to check:

  • If you have access to the dashboard, go to the plugin’s settings and check the block list. If your address is there, release it.
  • If you have no access, go to wp-content/plugins in FTP and rename the security plugin’s folder. WordPress will deactivate it, and its settings will be kept.
  • If it isn’t clear which plugin is at fault, rename the plugins folder to plugins.hold, go to /wp-admin/plugins.php, change the name back to plugins, and activate the plugins one by one.

If you deactivated all the plugins and the error went away, don’t leave the site that way. Reactivate the plugins one at a time and test the blocked address after each one. The plugin after which the error returns is the one whose settings need checking.

And once you’ve found the rule that blocks, it is better to fix it in the plugin’s settings than to leave the plugin off, because a deactivated security plugin means a less protected site.

Step 5: the firewall on the server and in Cloudflare

On the server: according to Cloudflare, on the server side a 403 error is also caused by mod_security rules and IP block rules. You can’t see these from inside WordPress. Contact your hosting company’s support with the exact address, the time and your IP address, and ask them to check whether a firewall rule blocked the request. If the site is behind Cloudflare, also make sure the server isn’t blocking Cloudflare’s IP ranges.

In Cloudflare: according to their documentation, Cloudflare returns 403 when a request violated a web application firewall (WAF) rule, managed or custom, and also because of additional security settings: Security Level (whose default is Medium), DDoS protection that runs by default, and Browser Integrity Check. In the Cloudflare dashboard, under Security Events, you can see the blocked requests and identify which rule blocked. When you find it, change the rule or add a precise exception for the blocked address, instead of turning off the protection altogether.

How a 403 error affects Google

According to Google Search Central documentation, Google treats all 4xx errors except 429 the same way: it concludes that the content doesn’t exist. A page that returns 403 to Google’s crawler is treated like a page that doesn’t exist. In Search Console, such pages appear in the page indexing report with the reason Blocked due to access forbidden (403).

Google also asks not to use 401 or 403 to limit the crawl rate, because 4xx codes (except 429) don’t affect it. So if a firewall blocks Google’s crawler, it doesn’t slow it down, it simply removes pages from the index. I expanded on this situation in my guide on why your website isn’t showing on Google.

When to stop and call an expert

There are situations where it’s better to stop before going on alone:

  • You have no recent backup, and you aren’t sure you could restore the site.
  • You aren’t sure what the correct permissions are on your server, or whether changing permissions would break something else.
  • The block comes from the server’s firewall, and you have no access to it.
  • Important pages appear in Search Console with the reason Blocked due to access forbidden (403) and you can’t find who is blocking Google.
  • You went through all the steps and the error still appears.

In situations like these, another attempt can make things worse or leave the site less protected. If you tried and didn’t succeed, talk to me and I’ll take care of it.

Frequently asked questions

What is a 403 error?

It is a server response saying the request was understood, but you don’t have permission to access the resource. The full name is 403 Forbidden. Unlike 5xx errors or the “There has been a critical error on this website” message, the server itself is working, and it chooses to block.

What is the difference between a 403 and a 404 error?

404 means the resource wasn’t found. 403 means it isn’t available to you. As far as Google is concerned the difference is small: according to its documentation, all 4xx errors except 429 are treated as content that doesn’t exist.

Why do I get a 403 only when I log in to wp-admin?

It is likely a block aimed at the admin area: a rule in .htaccess, a security plugin that blocked your IP address, or a firewall rule. Check steps 2, 4 and 5 in order.

Is it enough to change permissions to 777 to fix a 403 error?

No. The WordPress documentation warns that permission 777 puts the site at risk. The recommendation is 755 or 750 for folders, 644 or 640 for files, and 440 or 400 for wp-config.php.

Does a 403 error hurt the site’s SEO?

If it also appears for Google’s crawler, yes. According to Google’s documentation, a page that returns 403 is treated as content that doesn’t exist. Check the page indexing report in Search Console.

How do I check whether Google gets a 403 on a specific page?

In Search Console, open the URL Inspection tool, paste the address and click Test live URL. The Page fetch field shows whether Google managed to get the page from the server, and under View tested page you can also see the HTTP headers that were returned. If you see the page in your browser and Google doesn’t, a firewall or security plugin is probably blocking the crawler.

I use Cloudflare. How do I know whether they are blocking?

According to Cloudflare’s documentation, if the error page doesn’t carry their branding, the error comes from the hosting server. If it does, check Security Events in the Cloudflare dashboard to find the rule that blocked.

Have a project worth talking about?

The call is free, with no commitment 😊