When operating WordPress website, nothing is more frustrating than the error “Sorry, you are not allowed to access this page“. Not only does it stop you from making changes but it also takes away everything you did before

But don’t worry! In this article, we will show you many different methods that have been tested before, to completely fix this error. These include:

  1. Return your website to the state before encountering an error.
  2. Use WP_Debug to get the error list.
  3. Check your access rights and error logs.
  4. Collect error messages of security plugins.
  5. Check file permissions (file permissions).
  6. Disable themes and plugins.
  7. Recreate the .htaccess file manually.
  8. Upgrade PHP to the latest version.
  9. Check the database prefix.
  10. Reinstall the WordPress site or export WordPress.

After reading this article, you will be fully equipped to handle errors when they arise. Let’s start!

What caused the “Sorry, You Are Not Allowed to Access This Page” error?

The “Sorry, You Are Not Allowed To Access This Page” error (“Sorry, you are not allowed to access this page”) usually happens when saving some custom changes on the site. It looks like this:

WordPress Error sorry, bạn không được phép đến Access trang này.

Basically, this error occurs due to security issues or permissions. However, to determine its underlying causes may be a problem.

For example, there is a heterogeneity between the data transferred between the website files and databases. If the data is saved for the original theme, plugin, or a non-WordPress component that is not correct for the database version, the request will not be executed properly, and the error “Sorry, you are not allowed to access this page” will showing up.

If the username and password in your wp-config.php file  do  not match the database, it also causes this error. Finally, another possible cause is if the site uses an older version of PHP. So the first thing is to always update to the latest version of PHP (we will show you how to do this later).

Through the whole article, you will know many different ways to troubleshoot this issue of WordPress. We start with the simplest methods that can easily fix errors, before going to more complex solutions if you still can’t find the cause of the error.

10 ways to fix “Sorry, You Are Not Allowed to Access This Page” Error in WordPress

Before starting any of the following methods, don’t forget to back up your WordPress site . Doing this ensures you can easily restore the website if you accidentally make mistakes during the error correction process. Don’t forget to backup, practice that routine and get started!

1. Return the website back to the time before the error occurred

For any errors you may encounter, this may fix the error because it returns the website to the state before the last change was made on your site. Because often, if any significant changes take place, it could be the main cause of the error. From updating your WordPress website to a new version, to converting the site from localhost, to making major PHP changes. You should also pay attention to the newly installed plugin or theme (or newly updated).

READ  How to add Menu Icons in WordPress with ThemeIsle

If you know what you changed the last time, simply try going back, such as deleting the theme or plugin you think is the cause of the error. Or use the WP Rollback plugin to restore the old version. You can also restore WordPress from a backup if you have backed up before the error occurred.

At Hostinger , all web hosting packages are automatically backed up. So you can get the backup there, including the files and MySQL database in the  Files ›Backups section  in the control panel.

website file and mysql backup in Hostinger

In case you do not know what changes you made the website show “Sorry, you are not allowed to access this page”, you can try using the following to handle this error.

2. Use WP_DEBUG to get the error list

To know what an existing PHP errors is, or it may cause an error for your WordPress site, try turning on the WP_DEBUG tool . To do this, open the wp-config.php file  and add the following lines of code (if not already available):

  1. define ( ‘WP_DEBUG’ , true ) ;

Then, you can see that WordPress displays a debug message on each of your sites. By reading through the error codes that the page has, you can know what is causing the “Sorry, you are not allowed to access this page” error.

After WP_DEBUG is turned on, you can also access the file wp-contents / debug.log . Open this file and you will see it list errors for you to check.

3. Check the error log

In addition to checking PHP errors in your files, you can also check the server error logs. This can help you get errors and limit the reasons that might cause the error.

It is up to the hosting provider to check the error log. If you have a hosting package at Hostinger, you can look through the error log checking guide on the website here . We also show you how to use the .htaccess file  to save the error code, and to handle the most common errors that may cause the error “Sorry, you are not allowed to access this page”.

If you still cannot determine the cause of the error from enabling WP_DEBUG or via the host’s error log, you can review the error messages from the security plugin.

4. Collect the error message of the security plugin

It may be the cause of an error as a result of someone’s attack or hacking action. If you have a installed security plugin that has the ability to send mail when there is any suspicious activity (such as Wordfence Security ), you should check inbox or in your spam folder to see. You may see a message regarding the time the error message appears.

If you have not installed any plugins, or do not have any security solutions, we recommend using one of the best security plugins. They can help you collect all the activity on your WordPress site, such as WP Security Audit Log :

WP audit security log snapshot

With this plugin, you can save changes related to WordPress source code, database adjustments and more. Therefore, it can be an effective tool to help you find the root cause of a problem “Sorry, you are not allowed to access this page”.

Check File Permissions

Another cause of this error is the misconfiguration of the permissions file . There are many ways for you to ensure file permissions are not flawed. Below, I will show you two simple ways to make sure the permission file is set correctly.

READ  2 ways to remove "Uncategorized" category categories in WordPress

If you have web hosting on Hostinger , we have a special tool for you. It is in the Other section ›Fix File Ownership in the control panel of hosting. With just one click, this tool will instantly identify and correct permissions for files and folders automatically for you.

fix file errors and directory permissions

Another way to get the above results is through FTP. Open the File Transfer Protocol (FTP) client , fill in the hosting information and the fields to fill. Visit the public_html directory  . In it, you select the directories named wp-admin , wp-content , and wp-includes. Next, choose File Permissions :

filezilla ftp folder root directory

In the Change file attributes window that has just appeared, you need to check if the value is 755 (if not, edit it to 755), the Recurse into subdirectories box is checked, and Apply to directories only is selected:

Change file permissions in Filezilla

Select OK to save the changes. Then, go back to the public_html  folder  and then select all the files in it. Do not select the 3 folders above that you just edited. You need to right-click the files, select File permissions again:

Change the permission file for public_html filezilla

In the Change file attributes window  , check or edit to 644 , Recurse into subdirectories box marked, and Apply to files only selected. Then click OK :

filezilla changes the attribute file that applies only to files

This will resolve the problem part (if any). In addition, it ensures basic WordPress site permissions are properly configured. In short, the directory permissions should be 0755, the file permissions should be set to 0644.

6. Disable all Themes and Plugins

As mentioned above, the newly installed or updated theme and plugin may be the cause of the error “Sorry, you are not allowed to access this page”. Therefore, the process is to disable all your existing plugins and themes. In case you cannot access the admin area to do this, you can disable themes and plugins manually using FTP. You just need to rename the plugin directory and theme folder to another name, you have disabled plugins and themes.

When done, reopen the web page to check if the error still shows up. If not, you will need to re-enable each theme, check how the website is whenever a plugin is enabled. If you see an error in this process, the theme or plugin you just activated causes an error. Now you just need to disable it again, and remove it completely from the website.

If it still doesn’t work, do not rush to close the FTP connection. You will need it in the following step.

7. Reset the .htaccess file manually

Without any successful solution, it is possible that the error is in the code of the .htaccess file . To process, go to public_html folder by FTP, find the .htaccess file . You need to rename this file to .htaccess_backup by right-clicking and selecting Rename .

Then right click again and download this file to:

download htaccess filezilla file

Open the file with text editor (TextEdit or Notepad). Rename it to .htaccess , and paste the following default snippet code into WordPress:

  1. # BEGIN WordPress
  2. RewriteEngine On
  3. RewriteBase /
  4. RewriteRule ^ index.php $ - [ L ]
  5. RewriteCond% { REQUEST_FILENAME } ! -F
  6. RewriteCond% { REQUEST_FILENAME } ! -D
  7. RewriteRule. /index.php [ L ]
  8. # END WordPress
  9. # BEGIN WordPress
  10. RewriteEngine On
  11. RewriteBase /
  12. RewriteRule ^ index.php $ - [ L ]
  13. RewriteCond% { REQUEST_FILENAME } ! -F
  14. RewriteCond% { REQUEST_FILENAME } ! -D
  15. RewriteRule. /index.php [ L ]
  16. # END WordPress

Then, save the file and upload it to your site. The file .htaccess is now reset, and this error will be handled if caused by the .htacess file.

8. Upgrade the version of PHP site to the latest version

A common error of “Sorry, you are not allowed to access this page” is by using an outdated PHP version. Moreover, using an old PHP version can expose you to security risks on the WordPress site. So please upgrade PHP to the latest version regardless of whether it fixes the error. Not allowed to access the website or not.

READ  5 Beste Strategie für Social Media-Marketing im Jahr 2019

Before upgrading to the latest PHP, make sure your site is compatible with it. Then make sure the WordPress site is backed up (if not already done).

We also recommend that you create a local staging copy of the site before upgrading. This will help you test how your site works with the new PHP version of WordPress.

After you have tested the site, and pleased to see it running smoothly on the new PHP version, there are 2 methods to completely upgrade it. If you are using Virtual Private Server (VPS), you can upgrade using the command line. However, if you do not have access, you can change the PHP version in the control panel or contact your hosting provider for advice.

If you are using Hostinger , the control panel will give you the tool to change the PHP version and extensions easily. You just need to go to Advanced ›PHP Configuration  to do this.

change php version

9. Check database prefix

What if you upgrade PHP and you still see the error “Sorry, you are not allowed to access this page”? If you program WordPress on localhost, and have just moved it to web hosting to run live, you may have forgotten to change the prefix, and it may be the main cause of this error.

To check if database prefix is ​​correct, open the wp-config.php file again , and open your WordPress database. You will need to check the prefix value (eg.  Wp_ ) between the two pages above to see if it matches. If not, change it in wp-config.php to match the database and test if you still see the error “Sorry, you are not allowed to access this page”.

10. Export or reset WordPress site

If all of these methods fail to fix errors, you should consider these last two ways. Especially with this step you need to make sure that your WordPress site is backed up.

Sometimes, the WordPress installer may cause an error “Sorry, you are not allowed to access this page”. In this case, you need to export your site to the new WordPress installer. There are several ways to do this, and we have a detailed guide for you here .

The last option is to reset WordPress site completely. Note that after resetting the database and losing everything, all content on the site is lost. If the content has been backed up, you can perform the restore after reinstalling WordPress.

Epilogue

As a WordPress user, you should understand the causes of errors and possible remedies to try. With this detailed error correction tutorial, we hope you will always fix the “Sorry, you are not allowed to access this page” error, and it is no longer a problem.

Are there any other questions or solutions to handle this issue of WordPress? Let us know in the comment section below!

Read more :
10 Ways to fix "Sorry, you are not allowed to access this page" error in WordPress

When operating WordPress website, nothing is more frustrating than the error "Sorry, you are not allowed to access this page". Not only does it stop you fr

Editor's Rating:
5

Leave a Reply

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