Fixing 403 on WP on SiteGround

For a new client site, we wanted to set up a test server for their site where we could show them new features, test updates before applying them to the live site, etc. However, when we created the duplicate site, it just produced a 403 error.

To create the test server, I created a subdomain pointing to a new directory on the server and copied over the WordPress server files. I made a new copy of the live database and then ran wp search-replace on it to update the URL as well as the server paths. Next, I updated wp-config.php with the new database information and verified server paths there. I also checked the htaccess file, but there was nothing in there to update.

That should have been everything, but the site would not load. It just returned a 403. I checked the error log, and I had a lot of “Permission denied errors for the htaccess file:

[Wed March 18 10:18:53.228808 2020] [core:crit] [pid 3886] (13)Permission denied: [client <ip_address] AH00529: /server/path/to/site/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/server/path/to/site/' is executable, referer:<lots_of_numbers>

I double-checked the htaccess file on the test site, and it had the exact same permissions as on the live site. In fact, all the files appeared to have the same permissions. I could not find any permissions that looked wrong or were set differently than the live site.

I then talked to support, and they recommended running the Fix Permissions utility they provide. To access it:

  1. Log into your SiteGround account.
  2. Open up cPanel (or the new custom SiteGround server admin panel).
  3. Scroll down to “WORDPRESS TOOLS” and click on WordPress Toolkit.
  4. You should now see a list of your WordPress sites. If the site you need to fix is not in the list, click “Add WordPress” in the upper right corner of the site list.
  5. Click “Manage” next to the site you need to fix.
  6. Click “Fix Permissions”.

When it was done running, I could not see any obvious permissions changes, but the 403 was gone and the site was working correctly.