The error 403 above is mostly due to file permissions, wrong PHP version, plugins or server security settings or wrong permissions.
Possible cause 1: Server Security – Mod Security. #
When making changes/updates/installation and publishing, you can disable mod security and once done turn it back on.
You do this on the cpanel as per the guide below.
Possible Cause 2: Corrupt .htaccess file #
Also, check that your .htaccess file is not corrupted or there are no deny rules.
What to check for are deny rules.
Deny access to .htaccess – This denies access to all .htacess files #
Order allow,deny Deny from all
The following code prevents anyone from viewing your website. Visitors will instead see a 403 when viewing your website. #
Order deny,allow
Deny from all
Require all denied
Denying access to specific file extensions #
The following code forces any file ending in .php to throw a 403 Forbidden error when visited:
Apache 2.2Order Allow,Deny Deny from All
Apache 2.4Require all denied
Resolution.
Remove all those rules.
If you suspect there are multiple .htaccess file that you may not be aware of, you can access
your cpanel terminal and delete all of them at once using the command below.
find . -type f -name ".htaccess" -exec rm -fv {} \;
Then only legitimate .htaccess file will be created.
Possible Cause 3: Wrong PHP version #
And if seeing the error on accessing the site, check that you are using the correct PHP version.
- Ensure you’re using the correct version for your site.
- Specifically to Truehost, since we do not use ALT-PHP versions, this may cause 403 if you use it.
Ensure the version is EA-PHP and not ALT-PHP.
Possible Cause 4: Plugins. #
Some wordpress plugins can block access to legitimate section of your site such as the admin dashboard.
Ensure to disable this plugins and check you can access your site.
Possible Cause 5: Files/Folder’s permissions. #
Ensure to set your files and folder permissions correctly.
Folders should use 755 and files should use 644.
All Done.
You may also watch the video below to assist on the issue.