How to Fix “Sorry, You Are Not Allowed to Access This Page”

by | Last Updated Jan 19, 2021 | WordPress | 0 comments

It’s not fun to lock yourself out of the WordPress admin dashboard. You know how it feels when you are trying to log in and receive a message that says, Sorry, You Are Not Allowed to Access This Page.

Fortunately, there are a bunch of fixes you can try.

With a bit of patience, you can resolve the error and manage your WordPress site again very soon.

This post will explain the Sorry, You Are Not Allowed to Access This Page error and why it happens.

Then we’ll show you a bunch of different approaches to help you figure out what works.

Let’s get this going!

Knowing the “Sorry, You Are Not Allowed to Access This Page” Problem

Yeah, we described Sorry, You Are Not Allowed to Access This Page as an error in this post.

But it’s not a WordPress error. It’s more like a security measure.

The notification indicates that a permissions setting is preventing you from entering a specific area.

Being locked out of a part of your site when you should have access to it becomes a problem. As an Admin, that means anywhere on the backend.

This usually happens after an update to a plugin, theme, or WordPress core.

You may get the Sorry, You Are Not Allowed to Access This Page message for lots of reasons.

WordPress might not recognize you as an administrator. The information stored in your database may not match what you have on your website’s code or a theme or plugin file.

Additional reasons could be an old version of PHP or incorrect information in your wp-config.php file.

This error may be preventing you from accessing some, or all, of the admin area.

Since you most likely can’t access critical settings via the dashboard, you’ll need SFTP or phpMyAdmin to fix it.

Before jumping into troubleshooting, make sure you’ve backed up your site.

When you encounter that Sorry, You Are Not Allowed to Access This Page notification, it’s hard to figure out what happened.

I know, I know, it’s so frustrating.

There are many solutions you can try to figure out the source of the problem.

How to Fix This Sorry, You Are Not Allowed to Access This Page in WordPress? (11 Ways to Fix It)

It takes patience to fix the Sorry, You Are Not Allowed to Access This Page error because there are so many causes you could have.

This long list of solutions can be overwhelming. However, it still covers many different scenarios to help you find the right one for your website.

1 – Restore Your Website to a Previous Version

The fastest and often most effortless way to get back into your dashboard is to revert to a previous version.

It could be due to a recent update that caused the error. By undoing your latest changes, you should be able to regain access to your site.

The downside to this method is that you could lose recent changes and figure out a solution to avoid causing the same error again.

Because of that, you might want to restore your backup to a staging site. You can then experiment with different modifications to figure out what’s wrong.

After figuring out what the problem was, you can undo the change and get your site back.

2 – Disable All the Plugins

A recent upgrade or addition of a plugin may have caused the error Sorry, You Are Not Allowed to Access This Page on your site.

If this is the case, it’s best to deactivate each plugin individually.

If the message disappears when you remove a plugin, you’ve found the source. After that, you can try troubleshooting it. Or take it off if you don’t need it.

Of course, if you lock yourself out, this process becomes more complicated.

You’ll need to use an SFTP client like FileZilla to connect to your site. You can also use DirectAdmin File Manager.

Now you can browse to the wp-content folder and find the plugins directory.

Open this plugins directory.

Rename WordPress Plugins Not Allowed Access Page

Now we’re going to rename your recently added plugin to plugin-old.

Let us now have a look at the site again and see if the issue has been resolved. If not, change the plugin’s name back to the original and repeat it with the next plugin.

3 – Activate a Default WordPress Theme

A theme installation or update could also cause the error.

You can fix this problem by switching over to a default WordPress theme like Twenty Twenty-One.

You have to do it via SFTP again if you don’t have access to your admin area.

Navigate to the wp-content > themes folder with FileZilla or DirectAdmin.

The rest is pretty much the same thing you did for disabling your plugins.

Rename WordPress Themes Not Allowed Access Page

Rename your active theme folder, then go back to your site and log in.

Renaming should break the active theme, and WordPress should activate the default theme. A notification should let you know that.

Once that’s done, you can troubleshoot the theme. Although we activated the wrong theme on your site, it should be accessible.

4 – Ensure That You Are the Administrator

Another possibility is that you were no longer listed as an Administrator because something accidentally changed your user role.

This frequently occurs in multi-site installations.

You can determine if this is the case by accessing phpMyAdmin and looking at the wp_users table.

wp_users Table phpMyAdmin

Please note your username and ID.

Then, find the wp_capabilities row in the wp_usermeta table.

wp_usermeta Table phpMyAdmin

If you have the Administrator powers, the meta_value in this row will look similar to this.

a:1:{s:13:"administrator";b:1;}

If your wp_usermeta table has a different entry, click on the Edit link so you can modify it.

You may also create an entirely new Administrator account from phpMyAdmin.

You can do this by returning to the wp_users table and clicking on the Insert tab.

Next, enter your new information in the fields.

Click the Go button once you have completed the creation. Your new user should appear in the table.

Next, note the account ID and return to the wp_usermeta table.

wp_usermeta Insert phpMyAdmin

Click on Insert again and enter the following information in the resulting fields.

  • umeta_id: Leave this field blank, and WordPress will fill it in for you automatically.
  • user_id: Use the ID found in the wp_users table in WordPress.
  • meta_key: Put this value as wp_capabilities.
  • meta_value: Add the line a:1:{s:13:”administrator”;b:1;}

Once you enter your new credentials, you should log in to your WordPress admin area.

Now, delete your old account. You can also change its role from a user to an administrator from the dashboard and delete the newly created one.

5 – Review Your Error Log to Identify the Problem

The error log on your server can simplify troubleshooting any problem on your site.

This log may indicate problems with your site’s files, plugins, or themes that are incompatible, database errors, or issues with your site’s plugins.

Depending on your hosting provider, you may view the error log differently.

If your website is Rovity’s premium cloud servers, you will get the error log quickly.

Just log in to your DirectAdmin account and click on the Site Summary / Statistics / Logs icon.

Then click on the Error Log link.

That’s it. You will see the generated errors logged in this file.

If you can identify the cause of the alert in your log, you can fix it. If not, you’ll need to move on to another solution on this list.

6 – Make Sure the Database Prefix Is Correct

There is a prefix for every MySQL database.

If the prefix listed in your website’s files doesn’t match the one on phpMyAdmin, you may get the message Sorry, You Are Not Allowed to Access This Page.

When migrating your site, you may run into this problem. For example, if you’re moving to a live server from a local staging site. You’ll need to access your wp-config.php file to check for any mistakes.

You can use SFTP to accomplish this, as we’ve covered in previous solutions.

Within the wp-config.php file, you need to find the database’s prefix. The default database prefix for WordPress is wp_. But it can be different.

WordPress Database Prefix Config File

In this example, the database prefix is wp3k_.

Then, log in to phpMyAdmin to see your database’s table prefixes.

They should be the same as those listed in your wp-config.php file, as shown below.

WordPress Database Prefix phpMyAdmin

If they don’t, you’ll need to adjust the wp-config.php file so they will be equal.

7 – Search for Differences in Your wp-config.php File

On a similar note, you should also review the WordPress configuration file for any changes.

This is particularly true if you received the Sorry, You Are Not Allowed to Access This Page message shortly after editing the file. Or if you believe your WordPress site got hacked.

You can look for anything abnormal by accessing your wp-config.php file using SFTP. This process is much easier if you have some change detection or file integrity monitoring tool in place.

8 – Upgrade to the Latest PHP Version

If your WordPress website is running on an outdated version of PHP, that could be the problem.

It should increase your site’s security and performance even if upgrading PHP doesn’t resolve this access issue for you.

You should create a backup of your site before you upgrade.

Even if you are locked out of your WordPress admin area, you can still make a backup from your DirectAdmin control panel.

Once your backup has been saved, go ahead and test to see if your website is compatible with PHP’s latest version.

You can accomplish this by using a staging site.

Switching to the latest PHP version in Rovity is pretty simple.

Just log in to your DirectAdmin account.

Then click on the Select PHP Version icon.

PHP Version Change in DirectAdmin

From the Current PHP version dropdown menu, choose the PHP version you wish to use.

Within a second, your website will be using the latest PHP version.

Easy, ah?

Is your website hosted with another provider?

You may be able to do the same thing with your hosting provider through your control panel. You might want to contact your web host for more information.

9 – Make Sure Your File Permissions Are Correct

There’s also a chance that your site’s file permissions have been altered.

In that case, WordPress may think that you are not authorized to view specific areas of your website, even if you are still listed as an Administrator.

You will need SFTP access to your server to view your site’s file permissions. Also, you can use DirectAdmin File Manager.

Enter the public_html directory once you’re logged in.

Then select wp-admin, wp-content, and wp-includes folders. You can pick all three folders simultaneously to save time.

FileZilla WordPress Change Folder Permission

Then, right-click on these folders and select File Permissions.

In the resulting window, ensure the following options are selected.

FileZilla WordPress Change Folder Permission Attributions
  • Numeric Value: 755.
  • Recurse into subdirectories: Check.
  • Apply to directories only: Select.

When you’re done, click on the OK button.

Then select all the other files within the public_html folder and right-click on them. And click on the File Permissions again.

Set the following option in the permissions window this time.

  • Numeric Value: 644

Once you have done that, return to your site and see if the Sorry, You Are Not Allowed to Access This Page error disappears.

10 – Make a New .htaccess File

Suppose none of the earlier solutions worked; your .htaccess file may need to be reset.

You can access the public_html folder through SFTP or DirectAdmin.

Similar to how we renamed plugin and theme files in our earlier solutions, you will need to rename your existing .htaccess file.

Something such as .htaccess_original or .htaccess_backup would work well.

If you are using DirectAdmin File Manager, you can directly edit the file and save it.

If you are using an SFTP client, then right-click the .htaccess file and choose Download.

In your text editor, open the downloaded .htaccess file and replace its contents with the following.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Rename this file as .htaccess and upload it back to your server. If this file caused the Sorry, You Are Not Allowed to Access This Page error; then renaming should now fix it.

11 – Reset WordPress to Factory Settings

There may be a problem with the WordPress installation. You can fix it by resetting your WordPress site.

Upon resetting your website, you will lose all posts, pages, and user comments. So, it is essential to have a recent backup you can restore after resetting the website.

There are a few ways to accomplish this, including using a WordPress plugin or WP-CLI.

It would be best to use this option as a last resort. So you won’t lose content on your site.

Summary

It is nerve-wracking to be locked out of your admin dashboard in WordPress. Thus, finding a solution to the Sorry, You Are Not Allowed to Access This Page error as quickly as possible is vital for your website and your peace of mind.

In this post, we covered a wide variety of possible causes for this issue and a variety of fixes. Let’s quickly summarize them.

  1. Restore Your Website to a Previous Version
  2. Disable All the Plugins
  3. Activate a Default WordPress Theme
  4. Ensure That You Are the Administrator
  5. Review Your Error Log to Identify the Problem
  6. Make Sure the Database Prefix Is Correct
  7. Search for Differences in Your wp-config.php File
  8. Upgrade to the Latest PHP Version
  9. Make Sure Your File Permissions Are Correct
  10. Make a New .htaccess File
  11. Reset WordPress to Factory Settings

Thanks for Reading, and Happy Fixing!

If you enjoyed this tutorial, then you’ll love Rovity and our fast-growing premium shared hosting on the cloud. Check our subscription plans.

We engineered our cloud infrastructure with Performance, Speed, Scalability, and Security in mind.

That’s why we built Rovity with AWS, CloudLinux OS, DirectAdmin, and LiteSpeed Web Server.

Come and experience the next generation of shared hosting on the cloud

By Jafar Muhammed

Jafar Muhammed has 10+ years of experience in WordPress, web hosting, domain names, DNS, CDN, server administration, etc. He is an open web advocate. He is the CEO of Rovity, the fastest growing premium shared hosting startup in India.

Check Out These Related Posts

Avoid These 8 Blogging Mistakes in 2021

Avoid These 8 Blogging Mistakes in 2021

Blogging plays a large part in the $400 billion content marketing industry. Blogs are an excellent way to make substantial extra income. They're also powerful tools for generating traffic to your website. Blogging isn't just a part-time gig and a digital marketing...

read more

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *