I have duplicated my site using the duplicator plugin from wordpress.org. However, when I wanted to run this on a new hosting service, first I encountered a 504 gateway timeout error. Therefore, I extracted the .zip contents and chose for manual package extraction, which solved the problem, but after the second step, again in the final step (test), I run into a 403 access denied error.
- I checked my access permissions, they were OK. (755 for folders and 644 or 666 for files)
- I checked my .htaccess file, it seemed to be OK. (I deleted it and the error appeared again).
- There are no plugins on my domain or host which might cause interference as I am installing the package afresh.
I don't know what is causing this problem.
My .htaccess file contents:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
403 Forbidden error code is shown when your server permissions don’t allow access to a specific page.
Another possible cause could be a corrupt .htaccess file or incorrect file permissions on your server.
If you were already using an automatic WordPress backup plugin, then make sure that you have access to the latest backup before moving forward.
Deactivate all WordPress plugins
Corrupt .htaccess File
Often the 403 error is caused by a corrupt .htaccess file in your WordPress site. Repairing this file is quite easy.
You need to delete the file from your server. (get backup file)
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.
File Permissions in WordPress
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’.
I hope this helped you fix the 403 forbidden error in WordPress
This is old but I would like to post something I'm about to try. I found that "open_basedir" may be enabled by default on some hosts, like the one I'm using. So I sent a request to the provider to disable it from "php.ini" file.