A common error that happens when you try to login to the WordPress admin section is ‘You are not authorized to view this page (403 error)’.
This 403 error gets displayed instead of the WordPress admin dashboard, after successful authentication using the admin login credentials.
What causes ‘You are not authorized to view this page (403 error)’
WordPress is programmed in PHP and the default page that loads once a admin user login, is the ‘index.php’ file.
The ‘Directory Index’ directive of a webserver is used to set the list of files to look for, when the client requests an index of the directory in a website.
But if the webserver where the WordPress site is hosted doesn’t support ‘index.php’ in ‘Directory Index’, this 403 error would show up instead of the index page.
In Apache webservers, ‘index.php’ would be already configured in ‘Directory Index’ section in the webserver configuration file. So, the 403 error is not seen much in Apache servers.
But in Windows servers, the ‘Default documents’ are used to configure ‘Directory Index’ for websites. The default documents that are enabled by default are:
- Default.htm
- Default.asp
- Index.htm
- Index.html
When a page request comes from a website, the IIS webserver checks the file names listed in this ‘Default Documents’ and sends it to the browser.
Since ‘index.php’ is not enabled as a Default document in Windows IIS server, this 403 error in WordPress is often encountered in Windows servers.
How to fix ‘You are not authorized to view this page (403 error)’
To update the Default Documents of your website to include ‘index.php’ file, follow these steps in Windows webserver:
- Open IIS Manager.
- Right-click the Web site for which you’ve installed WordPress and then click ‘Properties’.
- Click the ‘Documents’ tab. Click to select the ‘Enable Default Document’ check box.
- Click Add. In the Default Document Name box, type the name of the default document (index.php) that you want to add and then click OK.
- Refresh your browser or login again to http://domainname.com/wp-admin/
To enable ‘Default Documents’ for a website, another option is to make sure that the following entries are present in the web.config file in the root of the website.
Now we have enabled processing of index.php file by the web server, and your WordPress admin dashboard would be displayed fine without any errors.
If you are on a Linux server, to ensure that index.php is returned by default for a directory, create an .htaccess file in that directory and add this line to it:
DirectoryIndex index.php index.html
403 error can also happen due to a corrupt ‘.htaccess’ file or wrong file permissions. To fix this, ensure that the .htaccess and index.php files have 644 permissions.
In short
403 error can show in WordPress during installation or when trying to login as user. The error message can vary with server, some showing ‘Access Denied’.
Certain WordPress plugins or security plugins in the server can also lead to 403 errors. In such cases, examining the error logs and each plugin is relevant to resolve this error.
Bobcares engineers resolve website errors in both Windows and Linux servers promptly by examining the server logs and related files.
If you’d like to know how to manage your server resources efficiently for your business purpose, we’d be happy to talk to you.
0 Comments