So you’re making changes to your website, and you want to save the updates you just made. All of a sudden you run into the “Sorry you are not allowed to access the site” error message. Perhaps you ran into this error out of the blue – either way, now you’re unable to access your admin area. Understandably, this can surely be an upsetting experience, as well as frustrating. The main reason being that this issue can be caused by a number of things.
In short, this problem is brought up by a permission issue or a security issue, however as mentioned earlier, factors causing the issue can be many.
Fret not – in this article, we’ll go through all the methods available when it comes to troubleshooting and solving this truly aggravating issue.
Before we even begin, it’s a good idea to create a backup of your website before making any further changes – this will enable you to revert back to the current version of your website in case anything goes wrong during the troubleshooting process.
It’s worth pointing out that this issue can be caused by your username or password not matching the ones in your database, so we recommend checking your wp-confing.php file to see if the details match. Another fairly basic thing that can be causing the issue is the latest version of WordPress not supporting the PHP version that you are using, so that’s another thing you can check.
Without further ado, here’s what you can do to try and resolve this issue, laid out in several steps.
- Reverting your site to the pre-error state
- WP_DEBUG and accessing your error log
- File permissions
- Theme and plugin deactivation
- Resetting the .htaccess file
- PHP version
- Reset your website
1. Reverting your site to the pre-error state
In case you can recall what type of modification you performed just before the error occurred, you’ve most likely found the culprit for the error message. This modification could be anything from updating the version of WordPress you are using, making some PHP changes, migrating your site from a local installation, installing a new plugin or updating the theme.
In case you have previously created a backup version of your website, you can restore your site to that version and effectively solve the issue. In case you have not created a backup copy of your website, note that hosting companies sometimes create backups of websites – you should either have the option to access this version of your site, or you could ask your hosting provider to restore to the previous backup of yours.
In case the error was not caused by the most recent update you made to your website, or you simply cannot recall what change you previously made, you can move on to the next step.
2. WP_DEBUG and accessing your error log
To get a better grip on the issue and what’s causing it, you can try turning on the WP_DEBUG in your wp_config.php file. This can help you detect the source of the problem.
You can access the error log and enable the WP_DEBUG through FTP using an FTP client (such as FileZilla). Locate the wp-config.php file which can be found in your root folder.
After you have located the wp-config.php file, you should set WP_DEBUG to true
Once this is set you will be able to access WordPress messages when accessing your site.
Setting the WP_DEBUG to true lets you access your error log, where you can check for errors that are on your server. These can usually be found in wp-content/debug-log or var/log, but do note that the location of the file can differ from host to host. The best course of action is to check your host’s documentation to see where it is located.
Do note that the WP_DEBUG option has a flaw of sorts - it forces WordPress to show errors and warnings on all pages, and these would be visible to your users at the time as well. It is not good practice to let your users see these errors so instead of using only the above-mentioned line, you can set WordPress up in such a way that it logs these messages into one or more files on your servers, keeping these hidden from your users’ sight.
In order to perform this, you will need to add the following code:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
To briefly explain these lines and how this feature works: with the first line, you enable the WP_DEBUG mode. Then, by using WP_DEBUG_LOG and by setting it to true, you can force WordPress to store messages into a debug.log file.
Now you will have an overview of a list of error messages when you access your site. If you wish to check out a more detailed version of the log, access the debug.log file which is located on your server.
These actions will let you access a variety of debug messages which can either help you determine what action of yours has triggered the “Sorry you are not allowed to access the site” message or if there was a possible unauthorized access to your site.
Another thing that is very useful is if you have previously installed some Security plugin which sends email report when there is a suspicious action, so if you do come to a point that you cannot access your site you can always check your inbox and spam folder of your mail for messages from the Security plugin that you have installed, which can, of course, lead you to find the cause of what might have happened.
Here’s another useful tip: in case that you cannot access your site for whatever reason, and you have installed some type of a Security plugin which sends email reports of any suspicious actions, you can check the inbox and spam folders of your mail to see if you can locate any messages sent by the Security plugin and pinpoint the issue this way.
3. File permissions
Incorrect file permissions can certainly be one of the causes, so please do check this on your end as it just as well may be what’s preventing you to access your site. To check if your permissions are set the correct way you will need to have an FTP Client. Directory permissions should be set to 755 and file permissions should be set to 644.
This can be performed through FTP, once you connect to your FTP client entering your host details. Then you should please navigate to your public_html folder.
Inside the public_html folder, you will find subfolders that you need to select; these include wp-admin, wp-content and wp-includes.
Right-click on the selected subfolders and select Permissions
Once this is done please assure that your Change file attributes window does have Numeric Value set to 755 and click save.
When you have edited the Directory permissions please proceed with the file permissions. You should go back to your public_html folder and select everything that is inside of it – make sure to remember to exclude the 3 folders that you have already altered, then right-click on the selected folders and select Permissions.
Now please make sure that the value you set is 644 – you should also tick the Recurse into subdirectories box and select Apply to files only.
If you happened to have any type of permission error earlier, it should be solved at this stage. In addition to this, this way you ensure that your WordPress files are configured the proper way.
4. Theme and plugin deactivation
One of the most common causes for this error is a theme or a plugin that potentially blocked your access to the admin area. The easiest way to look into this, since you cannot do it from your admin area, is to access your theme folder through an FTP program (e.g. FileZilla).
Navigate to your theme files that are located in wp-content/plugins. The easiest way to do this is if you rename the plugin. You can do that by simply adding –disabled to the existing plugin name.
You should do this with every plugin that you have on your site, and you should check if anything has changed after renaming every individual plugin – you should do this to be able to determine if it is a matter of a plugin conflict, and to make sure which plugin is causing it.
To check if the issue is being caused by a theme that you have activated, you can simply go to wp-content/themes and rename the active theme to test if it is a matter of the theme itself. Testing this way lets you know immediately whether the error is being caused by one of the plugins or the theme. If you refresh your site after disabling a plugin or the theme, and the error is gone, you can rest assured that the last plugin or the theme you have renamed is the cause of the error.
If this is not the case and all plugins and themes check out just fine, keep your FTP client as you will need it for the next step.
5. Resetting the .htaccess file
Navigate to the root folder with the FTP Client. Once you have public_html selected you will be able to see the .htaccess file.
Just to be on the safe side, the best practice would be to download your .htaccess file and store it securely on your computer.
6. PHP version
Using an older version of PHP can pose a security risk on your website, and regardless of whether this would fix the issue or not, it is definitely worth updating it. First, you should check if your theme supports the latest version. Note that it is always a good idea to make a backup of your site, just in case.
All Qode Interactive-developed themes are premium WordPress themes, which also means that they are a bit more demanding when it comes to resources than some more basic themes. Therefore we do recommend that you use a PHP version 7 or higher with our themes, as the overall performance should see an improvement, and generally, a heavier theme should run far more smoothly. This is why we always recommend checking if you are running the correct PHP version.
You can find an in-depth explanation of all the new features PHP 7 brings as well as instructions on how to upgrade to this version here - you can also always contact your hosting provider to upgrade your PHP version for you.
If the issue is still not resolved, there can be another possible cause for the error. Sometimes it might happen that once you migrate your site to a live server, the database prefix happens to be incorrect. You should open your wp-config.php file as well as your database and check if the prefix value wp_ in your wp-config file matches the one in your database. If there is any difference between the two, please change these to match, and then double-check if “Sorry you are not allowed to access the site” error is gone.
7. Reset your website
If none of the abovementioned methods and solutions helped you resolve the issue, we recommend you trying to reset your website. To achieve this, you will need to export all of your website content and store it safely on your computer, and then simply try to install WordPress once again manually. Once you have done this, you can try to import your stored files to check if the issue has been resolved.
Do note that if you reset your database, your content will be gone. However, if you have backed it up, as we previously advised, you will certainly be able to restore your content without any difficulties.