Here are possible reasons that can cause the 403 Forbidden error:
- Incorrect file and folder permissions ‒ users lack the necessary permissions to access certain files or sections of a website.
- Corrupted .htaccess file ‒ misconfiguration or malware can corrupt the .htaccess file.
- Missing index page ‒ the default homepage template (index.html or index.php) is not present in the website’s directory.
- Incompatible WordPress plugin ‒ a WordPress plugin may conflict with another plugin or be improperly configured.
- Incorrect IP address ‒ the domain name directs to an incorrect IP address, causing the website to block access.
- Malware scan ‒ security measures may restrict access to certain resources to prevent malicious attacks.
- Updated web page link ‒ the webpage link was recently changed, differing from the cached version.
- Empty website directory ‒ the URL attempts to access the website’s directory instead of a specific file.
How to Fix the 403 Forbidden Error
-
Clear Your Browser Cache and Cookies
The browser cache speeds up website loading on future visits. However, if a web page’s link changes, it can cause a mismatch with the cached version and trigger the 403 HTTP status code. Browser cookies – small files that remember your preferences and details – can also be a common cause of the 403 Forbidden error.
While caches aim to improve website loading speed, cookies focus on personalizing your browsing experience. That’s why a forbidden page error often occurs on a frequently visited website.
Keep in mind that clearing your cache and cookies will force the browser to re-request site files, requiring you to sign in again on most websites.
Steps to Clear Cache and Cookies on Google Chrome
(These steps are similar for Firefox and Safari.)
- Click on the three-dot icon in the top right corner and select Settings.
- Navigate to Privacy and security → Clear browsing data.
-
- Use the drop-down menu to choose the time range. It is recommended to select All time to remove all old files. Then, select Cookies and other site data and Cached images and files.
- Click Clear data to erase them.
-
After completing these steps, try revisiting and logging into the problematic website to see if it fixes the error. This method also works for other errors, like the 400 Bad Request.
-
Disable VPN Temporarily
A virtual private network (VPN) can trigger a 403 Forbidden error on websites that block access from VPN servers due to security or regional restrictions.
To test this, temporarily disconnect your VPN and try accessing the web page again. If this resolves the error, consider the following options:
- Switch to a Different VPN Server: Some websites may block specific VPN servers. Switching to a different server may help you bypass the restriction.
- Contact Your VPN Provider: Reach out to your VPN provider for assistance. They may offer alternative solutions or recommend servers that are less likely to be blocked.
-
Disable CDN Temporarily
A content delivery network (CDN) is a network of servers that caches and delivers content from the closest web server to the user, reducing load times and bandwidth usage.
If your website uses a CDN, it may cache a 403 Forbidden error due to issues like file permissions, IP blocking, and incorrect .htaccess rules. Temporarily bypassing the CDN helps determine whether the source of the error is the original web server or the CDN itself.
For Hostinger users, if you are on the Business Web Hosting plan or above, the in-house CDN is automatically enabled. Follow these steps to troubleshoot a 403 Forbidden error by disabling Hostinger CDN temporarily:
- Navigate to Performance → CDN from the hPanel.
- Find the CDN status section and click Disable.
-
If this fixes the issue, keep the CDN disabled for now and contact Hostinger's support team for further troubleshooting assistance.
-
Scan for Malware
The
.htaccessfile is a web server configuration file that primarily works by altering the Apache web server settings. Located in your website’s root directory (public_html), it contains a set of rules for how your website should behave in certain situations, including who can access what resources or pages.If your WordPress site is infected with malware, it can inject unwanted code into the
.htaccessfile. Changes to these rules can cause the HTTP status code 403.Hostinger users can leverage the built-in scanner to remove malware in WordPress. You don’t need to purchase third-party integrations because the automated tool can scan your websites for malware for free.
Steps to Scan for Malware Using Hostinger's Built-In Scanner:
-
Navigate to Security → Malware Scanner in hPanel:
-
-
Review Scan Results:
- If no malware is found, this section will display your hosting plan’s name and the time since the last scan.
- If malware is detected, the malware scanner will summarize detected malicious files in the past 30 days and the actions taken to fix them.
For extra security, use a WordPress malware scanner plugin to identify malicious software on your WordPress website. The top WordPress security plugins, such as Sucuri and Wordfence, offer this feature.
If the error persists after fixing the infected file, it is recommended to create a new
.htaccessfile. -
-
Restore the .htaccess File
If your
.htaccessfile is infected or misconfigured, you can replace it using an FTP client or file manager.For Hostinger users, follow these steps to locate and create a new
.htaccessfile. If you’re using cPanel, the steps should be similar:Steps to Restore the .htaccess File Using Hostinger's hPanel:
-
Navigate to Files → File Manager in hPanel:
-
-
Backup the Current .htaccess File:
- Open the
public_htmldirectory and locate the.htaccessfile. - Right-click on it and select Download to create a backup on your local computer.
-
- Open the
-
Delete the Current .htaccess File:
- Remove the existing
.htaccessfile from your hosting account.
- Remove the existing
-
Create a New .htaccess File:
- Click New file and name it
.htaccesswithout any extensions. -
- Click New file and name it
-
Copy and Save the Following Code to the New File:
plaintextCopy code# Enable URL Rewriting RewriteEngine On # Rewrite rule to redirect requests to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] -
Save the New .htaccess File:
Steps to Restore the .htaccess File for WordPress Websites:
- Log in to Your WordPress Dashboard:
- Navigate to Settings → Permalinks:
- Click the Save Changes Button at the Bottom Without Making Any Modifications:
- This will generate a new
.htaccessfile for your WordPress site. -
- This will generate a new
After completing these steps, try to re-access the web address. If this method fixes the 403 Forbidden error, it indicates a corrupted
.htaccessfile. -
-
Reset File and Directory Permissions
Websites have specific file permissions that control how users can read, write, and execute data. If misconfigured, these permissions can cause HTTP 403 Forbidden errors.
Using Hostinger's hPanel
With Hostinger, you can fix file permission issues in just one click:
-
Open hPanel and Search for "Fix File Ownership":
- Use the search bar to find Fix File Ownership.
-
-
Execute the Tool:
- Select the confirmation checkbox and click Execute. The tool will automatically assign default permissions to all website files and folders.
-
Using FileZilla
Alternatively, you can manually reset file and folder permissions using an FTP client like FileZilla. This method requires an understanding of FTP protocol and file permissions.
-
Connect FileZilla to Your Website:
-
Change Directory Permissions:
- Right-click on the
public_htmldirectory and select File Attributes. -
- In the Numeric value field, enter
755. This value allows only the owner to read, write, and execute the file or directory, preventing others from modifying it. -
- Select Apply to directories only, and click OK.
- Right-click on the
-
Change File Permissions:
- Right-click on the
public_htmldirectory again and select File Attributes. - In the Numeric value field, enter
644. This value allows the owner to read and write, while others can only read. -
- Select Apply to files only, and click OK.
- Right-click on the
After applying the correct permissions, try accessing your website again to see if the permission error is resolved.
-
-
Disable WordPress Plugins