Are you experiencing the “sorry, you are not allowed to access this page” error even after being the admin of your website? It can be a matter of concern for every website admin. However, several WordPress admins face the very same issue, and it can be fixed. This error can be caused due to several reasons, and in most cases, you don’t need professional help to fix it. After you have identified the cause of this error, it can be fixed in no time and your WordPress website will be fixed within minutes. Fixing this error and other WordPress errors is crucial to keep your site optimized and minimize revenue loss.
Unlike other WordPress errors, the “sorry you are not allowed to access this page” one does not affect the end-users. The only problem it causes is making your site inaccessible. The main culprit of this issue is user permissions. Troubleshooting this error requires some basic skills and a little patience. The “you don’t have permission to access / on this server” error often locks the admin out and makes it challenging to access your WordPress website. To help you narrow down and resolve this error, we have listed out 7 methods that can be used as potential solutions to fix this error. Have a look at our guide, and try our solutions to get rid of this issue and get back to your WordPress website.
Activate A Default Theme To Check For Issues
If you have recently updated your site’s theme, it can be a reason behind this error. You can easily test if your WordPress theme is causing a problem. The process of checking a theme is similar to checking a plugin.
Start by finding the wp-content/themes folder, and rename it. Then, check the front end of your website. If the error is automatically resolved, rename the themes folder, and make your way to each theme until you find the faulty one.
In case the theme is central to your workflow and site, you should contact a professional developer to fix it. If you are unsure about fixing your theme, you can find any other suitable one for your website. Choosing a new and suitable theme is a better option to get rid of the “you are not allowed to access this page” error. In case, the error is not resolved, you should rename the themes folder and make your way to other steps.
Check Your WordPress Error Log
When you face the “sorry, you are not allowed to access this page” error, you should start checking your error log. There, you can find a pointer that will help you fix the issue and get your WordPress website up and running again.
You can easily access this error long through a dashboard. If you cannot access your dashboard, there is a simple solution for that. Start by accessing your website through SFTP. You should use your credentials found in the hosting control panel. The WordPress site will mostly be within the public_html or the www directory. However, you can also find it in the folder named after your website.
Once you are in the folder, you will see a list of your WordPress files. In this folder, you should look for the debug.log file. You can also find this option in the wp-content folder. But, if the option is not there, you should try all the other steps in the list. You can also enable the debug mode and retest, but make sure to use the same steps while fixing this issue.
In case, you do find the option, open it and look. Understanding the content is a bit challenging if you don’t have a working understanding of technical aspects. But, you can check if there are any errors related to the changes you have made. If you do find some, you can use the rest of the options to fix that specific issue and resolve the “sorry, you are not allowed to access this page” error.
Create A New .htaccess File
Another step you can take to fix your WordPress website is through the .htaccess file. Your .htaccess file works as an Apache server configuration file, and it can be a reason behind your issues. To identify if this is the issue that is causing the “sorry, you are not allowed to access this page” error, you should make your way to your site’s root directory through SFTP.
Once you are there, you should start looking for the .htaccess file. Sometimes it is a hidden file, and it doesn’t exist due to the host’s server, and it can be one of the reasons why you can’t find it. If the file does not exist, you should try any other step from this list. However, if you find it, right-click on the file and rename it as — .htaccess-backup. Next, you should right-click and download this file to your computer. Once you have done this, you should open the file in your editor, clear out some of the contents, and add this code:
#BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCOnd %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
#END WordPress
This code is a default .htaccess file, and after you have finished editing the file, save your changes, and upload the same into your server. After you have completed this method, try accessing your website and see if you are still getting the “sorry, you are not allowed to access this page” error.
Check Your Plugins By Disabling Them
The “you are not allowed to access this page” error is based on the user permission issues. This is why you should also check your plugins and themes to check if these are the ones responsible for causing this issue. If you have recently updated the theme or added a new plugin, they may cause problems with your permissions. Under this solution, you will need to be within your site’s directory using SFTP. After you are in the directory, make your way to the wp-content folder, and look for the plugins directory.
You can check if there is an issue here by renaming the folder to anything other than plugins. After you have renamed the folder and completed this step, check if the error is resolved. If the “your device is not allowed to access this page” error is resolved. Then, the issue lies with any of the plugins you installed. Continue with the method, by opening up the folder, and within this directory, all the installed plugins are listed. Here, you will need to rename each plugin folder and check for the error on your site.
When you have found the faulty plugin, you can choose between the two options. Either you can remove it completely and find an alternative, or you can contact the developer for a fix. If the error is not fixed, and you still cannot access your website. Then, any other theme or element can be causing this error, and you can use other methods to fix that.
Make Sure The File Permissions Are Accurate
When you are using SFTP, you can check some other aspects of your site to ensure whether these are responsible for the “you do not have permission to access this page, please refer to your system administrator” error. The file permissions can be a key cause of this error and checking it makes perfect sense.
To check, you should select the “wp-content”, “wp-includes”, and “wp-admin” folders within the SFTP client. The next step is to right-click on them and find the “file permissions” setting. You can find a clear option for this in the FileZilla, but the Cyberduck hides this setting under the info panel. Navigate to the dialog box, and ensure that permissions are set like this:
- The numerical value must be set to 755
- Ensure that you have checked the “apply to directories” box only
- Also, make sure, “recurse into subdirectories” is checked
After putting the settings like the following, save the changes, and select all the other files within your site’s directory. Enter the “file permissions” dialog again. However, you should check the “Apply to files only” and “Recurse into subdirectories” boxes, and set the numeric value to 644.
These settings will ensure the right file permissions are set for your website. These will allow you to fix the error and access your website in no time. Once you have completed these steps, check if the error is resolved and if it hasn’t, move on to the next solution.
Check The User Roles
Another method to fix the “sorry, you are not allowed to access this page” error is by using a tool to access your WordPress database. You can use tools like phpMyAdmin to access the same. This database contains everything on your WordPress website, including the user role. In case this has been changed from the admin role, it can cause certain errors in your website, and you may not be able to access some parts of it.
How To Check The User Roles
The hosting control panel can give you access to a database tool. This is why you should navigate to the same. You will find a link to follow, but the location will depend on your hosting provider. Thus, if you are using Kinsta WordPress hosting, Cloudways hosting, or any other the location will be a bit different.
Once you are inside, look for your database. The name must match the one with your control panel. Once you have reviewed that, you should take a look at the “tables” meaning the various entries within your database. All of them must have the same prefix. Make sure your prefix value is correct, if it is different, you should go back to the wp-config.php file and change the value before moving on with the rest.
Once this is done, you should continue by clicking the wp_users table. Find your username and ID from the right-hand list, and note them down. Next, move on to the wp_username table and review the wp_capabilities row. The user role will be shown in the meta_value field. If this field displays anything except for the administrator, you should click the “edit” link and change it. While you are doing this, make sure not to change anything else surrounding the text.
After completing this method, you should check your site to see if the “sorry, you are not allowed to access this page” error is gone. If it is not, then any of the other methods will work.
Check Whether the wp-config.php File Has Changed
Since the wp-config file usually contains all the configuration settings of the website, if this file has been changed or compromised in some way. It can result in the“sorry, you are not allowed to access this page” error. This is why you should ensure that this file has not been compromised. To check, first, go to the SFTP client, and right-click on the file to open it with a text editor. Once the file is opened, you should scan it to scoop out anything inaccurate.
Most users are not aware of what they are looking for. Thus, unless you notice something extremely strange, it mostly is fine. But still, you should note one setting in this file. Start by scrolling down the wp-config.php file until you find the $table_prefix setting. In this setting, you should note down the value, and when you are using the phpMyAdmin tool in some other fix. You can use that tool to compare this value to the data there.
This will offer you a better chance of identifying the cause behind the “sorry, you are not allowed to edit this post” error, and help you fix it.
What To Do If Nothing Works
If all these methods don’t work, and you still cannot fix the “you do not have permission to access this page, please refer to your system administrator” error. Then you can use some other ways to resolve it, such as :
- Resetting your WordPress website
- Restoring a site from a recent backup
- Or, by upgrading your PHP version.
If things. Still doesn’t work, you can contact your host or any other professional for help.
Bottom Line
All in all, the “sorry, you are not allowed to access this page” error is a permission error rather than a site failure, and in most cases, it is easily fixable. There are several reasons that can cause this error to pop up, and identifying these issues doesn’t take much time. In this guide, we have listed the top methods to fix the user permission error and get your site back on track. Checking your error log can be the first thing you do to start working in the right direction. Quick fixes like sibling plugins and themes can often resolve the permission error. However, if nothing works, contacting support is the smart choice.
Also Read- WORDPRESS ADMIN SLOW