How to Fix 403 Forbidden Error in WordPress

The 403 Forbidden Error in WordPress is an HTTP status code indicating that access to the page or resource you were trying to reach is absolutely forbidden for some reason. Different scenarios can trigger this error, including issues with your WordPress plugins, a corrupt .htaccess file, incorrect file permissions, or server-side restrictions. Here’s how to troubleshoot and fix the 403 Forbidden Error in WordPress:

Check for .htaccess File Corruption

The .htaccess file is a configuration file used by Apache-based servers and can become corrupted. Here’s how to check and fix it:

  • Access Your Site via FTP or File Manager: Use an FTP client or the file manager provided by your hosting control panel.
  • Locate the .htaccess File: It’s in the root directory of your WordPress installation. Make sure to show hidden files, as files starting with a dot (.) might be hidden by default.
  • Rename the .htaccess File: Rename it to something like .htaccess_old. This will deactivate it.
  • Test Your Site: If your site works after renaming the .htaccess file, it was likely corrupt.
  • Create a New .htaccess File: Go to the WordPress Dashboard > Settings > Permalinks and simply click ‘Save Changes’ to generate a new .htaccess file.

Check File Permissions

Incorrect file permissions can also cause a 403 error. Files should be set to 644 and directories to 755.

  • Access Your Site via FTP or File Manager: Navigate through your WordPress files and folders.
  • Check and Correct Permissions: Right-click on files and directories to check their permissions. Adjust them if they’re not set to 644 for files and 755 for directories.

Deactivate Plugins

Sometimes, a WordPress plugin can cause this error, especially if it’s related to security. To check if this is the case:

  • Deactivate All Plugins: Access your site via FTP or File Manager, navigate to the wp-content folder, and rename the plugins folder to plugins_old. This deactivates all plugins.
  • Check Your Site: If the error is resolved, one of the plugins was causing the issue.
  • Find the Culprit: Rename the plugins_old folder back to plugins and then reactivate each plugin one by one in the WordPress Dashboard until you find which one causes the 403 error.

Check for Hotlink Protection

Hotlink protection settings on your server might mistakenly block legitimate requests, leading to a 403 error.

  • Check Hotlink Protection: This can usually be done through your hosting control panel. Ensure it’s not misconfigured to block access to your own content.

Consult Your Hosting Provider

If none of the above steps work, the issue might be at the server level.

  • Contact Hosting Support: Your hosting provider can check for server-side issues causing the 403 Forbidden Error, such as security plugins, firewalls, or server settings.

Restore From a Backup

As a last resort, if you have a recent backup of your website, consider restoring it to a point before the 403 error occurred.

Conclusion

The 403 Forbidden Error can be frustrating, but it’s usually fixable through troubleshooting steps like checking the .htaccess file, adjusting file permissions, deactivating plugins, or switching themes. Always ensure you have a recent backup before making significant changes to your website.