Troubleshooting Access Denied Errors in WP-Admin
This morning I attempted to log into one of the WordPress sites that I manage so that I could moderate some comments. Navigating to my site’s domain was no issue, the site loaded just fine. But when I tried to access the admin screen via wp-admin I was presented with a completely white screen that only said “Access Denied”.
“Access Denied” was an odd message to get since I hadn’t tried to login yet. As a matter of fact, I was not even presented with a login screen, just an “Access Denied” message. Interestingly, I checked the server logs and noticed a bunch of 403 errors on the wp-login.php page.
So, off to Google I went. I first came across an article on WPBeginner which mentioned the following steps to troubleshoot:
- Check for .htaccess file corruption
- Check file and folder permissions
- Check for any errant plugins that could be causing the issue.
My .htaccess file turned out to be ok, and all the folder and file permissions were set properly. I hadn’t updated any plugins in a long while on that particular web site so I wasn’t too concerned about that.
I decided to reach out to my hosting provider for support. (I’m currently using Interserver and their support staff has been exceptionally responsive) I typically try to spend a good deal of time troubleshooting on my own before I reach out to my hosting provider. There is usually a good amount of troubleshooting I am able to do, and in the event that I can’t fix something myself the information that I gather is ultimately helpful to the hosting provider’s support staff.
The first thing that support asked me to do was temporarily disable my CDN. I did this and we realized that the whole site was unaccessible. It turned out that my CDN had cached the main site (but not the admin pages) so that it appeared that my site was online but in fact it wasn’t. This was a great first step in troubleshooting.
The support technician then looked further into the server logs and noticed this php error:
Unknown: open_basedir restriction in effect. File(…/public_html/index.php) is not within the allowed path(s): (C:/Inetpub/vhosts/[myhostname]\\;C:\\Windows\\Temp\\)
It turns out that the hosting provider just had to update some php settings (similar to what is described in this link) and my site was running again. I re-enabled my CDN and was able to access both the site and wp-admin.
So if you find yourself being able to navigate to your WordPress site but unable to access wp-admin, first disable your CDN to see if your site is generally working, and if it’s not then contact your hosting provider’s support staff.