DEV Community

Danilo Desole
Danilo Desole

Posted on

Wordpress 403 errors

Ever wonder why your WordPress website suddenly starts showing you a 403 error when you try to log in to the wp-admin side? It happened to me recently, and I had to do a LOT of investigation before figuring out what was wrong. All the blog posts I found suggested the following:

  1. Check File and Folder Permissions – Your WordPress directories should have 755 permissions, and files should be 644. You can adjust these via FTP or your hosting panel.

  2. Inspect the .htaccess File – Sometimes, hosting providers modify this file to prevent brute-force attacks, which can inadvertently block access. Try renaming it temporarily to see if that resolves the issue.

  3. Whitelist Your IP Address – If your host has strict security settings, you may need to whitelist your IP to regain access.

  4. Disable Security Plugins – Some security plugins may block admin access. Try renaming the plugin folder via FTP to disable it.

  5. Check for Malware – If your site has been compromised, malware could be restricting access. Running a security scan might help.

  6. Contact Your Hosting Provider – If none of the above work, your host might have firewall rules or restrictions causing the issue. They should be able to assist.

None of the above worked for me, except that I did not contact my hosting provider, given that I was copying a website from another host where it was working perfectly. So what happened? The reason my WordPress website was returning a 403 error when I tried to log in to the wp-admin area lay in a database dump.

To give some background on my process, I was moving a website from one hosting provider to another. I proceeded with the usual file backup and database dump. Then, I moved the files to the new hosting and imported the database dump into the new database server. I modified the wp-config file, and then the first error occurred—WordPress was telling me that tables did not exist.

Checking the wp-config file, everything seemed correct. However, upon closer inspection, I noticed that the database prefix in my wp-config file was uppercase, while the imported table prefix was lowercase. Easy fix, I thought! I simply updated the wp-config file with the lowercase prefix.

Then, the website was able to run, I had access to the end-user front-end. However, when I accessed the wp-admin area, a 403 error occurred. After trying all the above solutions, none helped. I took another look at the database, and by chance, I noticed that in the wp-usermeta table, some rows contained the table prefix in the meta_key field!

Updating the database dump to use the uppercase prefix, re-importing it, and finally updating the wp-config file helped me fix the issue.

A few things went wrong:

  1. PhpMyAdmin exported the database with a lowercase table prefix (why?).

  2. I had an initial issue where WordPress was not able to find some tables in the database, and I ignored it.

  3. I updated the wp-config file table prefix without actually modifying the database.

Let me know what you think about this article—it's my first one in this community, and I really appreciate your feedback to improve.

Cheers!

Top comments (0)