Knowledgebase

403 Error Forbidden - It appears you don't have permission to access this page

What

Your site was working fine, and then, when you wake up the next day, this is what you find:

Why

When a user visits your website, the web browser tries to fetch the index page in the public_html folder of your website by default, if it cannot find an index page, it displays the content of your website to the user. But on our servers, for security reasons, we disable your site visitors from seeing the content of your website public folder (this includes the public_html folder and every other subfolder in it), therefore if the public_html folder does not have an index page/file in it, the error 403 is triggered when visitors try visiting your website without specifying a destination page. that is why yoursite.com/wp-admin or yoursite.com/contact can load meanwhile yoursite.com will give a 403 error, because no page was specified and an index/default file could not be found in your website by the browser to load to the user.

Therefore the most common cause of a 403 Error Forbidden message on your website is a missing index file in your public_html folder (could be index.html or index.php). Additional causes can be wrong permissions set for the file you are trying to access. If you are using Wordpress then this can be caused by a corrupt WordPress installation or a recent plugin installation which introduced malware into your files and either deleted your main index.php page/file or changed its permission.

The Solution

For websites built with pure coding 
All you have to do is upload your index file again into your public_html folder in your file manager through cPanel.

For websites built with Wordpress 
Login to your cPanel, click on file manager,

Open the public_html folder, and locate the index.php file.

If you can find the file, then all you need to do is change the permission of the file by right-clicking on the file and change its permissions to public read.

If you cannot find the index.php file (which is likely the case with a 403 error) then it most likely has been deleted by malware or a plugin you recently installed. Try the process below or get a professional web developer to do it for you.

Restoring WordPress index.php file
If you’re missing any core WordPress files, such as example.com/index.php, you can simply download a copy of the version of WordPress you’re running and upload that index.php file to your account. You can download all versions of WordPress here.
If you’ve made any changes to your index.php files, these techniques will not work for you. The average user, however, will not ever edit WordPress PHP files directly, so restoring deleted index.php files should be a simple procedure.

If the above solutions do not still work for you, You will have to delete your WordPress installation and install a new one because your WordPress site has been corrupted.

To make sure this doesn't happen another time please do not install plugins randomly and make sure you back up your WordPress installation regularly so that in an event of another occurrence, you can safely delete your WordPress installation, install a new one then restore your backup installation into the new WordPress installation.
Click here to read more on how to backup your WordPress website through Softaculous

Was this answer helpful?

1 Users Found This Useful