How to Fix the 403 Forbidden Error in 2024 (10 Effective Methods)

The 403 Forbidden error is one of the many issues website owners face. This error typically occurs when a site tries to prevent unauthorized access to sensitive files due to an empty website directory or permission issues.

Encountering the 403 Forbidden error can be frustrating. To help you troubleshoot this issue, this guide will explain the 403 error, its causes, and ten effective ways to resolve it. You’ll be able to fix the error and regain access to the website in no time.

Download Comprehensive HTTP Status Codes Cheat Sheet

Error code403 Forbidden Error
Error typeClient-side error
Error variationsForbidden: You don’t have permission to access [directory] on this server
HTTP Error 403 – Forbidden
Error 403 – Forbidden
403 Forbidden request forbidden by administrative rules
403 Forbidden
Access Denied – You don’t have permission to access
Error 403
HTTP 403
Forbidden
Error causesAccess misconfiguration
Corrupt .htaccess file
Missing index page
Broken WordPress plugin
Wrong IP address
Malware infection
New web page link


The 403 Forbidden error is an issue that occurs when a web server receives a request but refuses to provide access to the resource. It’s a standardized HTTP status code that means the web server understands the request but cannot grant access due to authorization issues.

What Causes the 403 Forbidden Error?

The HTTP 403 Forbidden error is often caused by access misconfigurations on the client side, so users can usually resolve the issue on their own.

A common cause of this HTTP status code is an issue with file and folder permission settings, which dictate who can read, write, and execute files and folders.

In such cases, there are typically two possibilities: either the website owner modified the settings to prevent directory browsing, or they failed to set the correct permissions.

Another common cause for this HTTP response code is a corrupt or misconfigured .htaccess file. If this is the case, the 403 Forbidden error usually appears after making changes to .htaccess. Usually, users can resolve this by creating a new .htaccess file or correcting its settings.

Beyond the common causes, here are other possible triggers for the 403 Forbidden error:

  • Missing index page – the website’s homepage isn’t named index.html or index.php.
  • Problematic WordPress plugin – if a WordPress plugin isn’t configured correctly or is incompatible with another plugin, it may trigger 403 errors.
  • Incorrect IP address – the domain name may be pointing to an incorrect or outdated IP address that now hosts a website that blocks your access.
  • Malware infection – malware can continuously corrupt the .htaccess file. Removing the malware is necessary before restoring the file.
  • New web page link – the site owner may have updated the page’s link, causing it to differ from the cached version.

Learn How to Fix the 403 Forbidden Error With Hostinger Academy

Watch this video to quickly learn about how to fix the 403 Forbidden error and its most common causes.

Subscribe For more educational videos! Hostinger Academy

How to Fix the 403 Forbidden Error

In this section, we’ll guide you through eight effective methods to fix the 403 Forbidden error and regain access to your website.

Site.com is forbidden - you don't have permission to access this resource.

Since file permissions and ownership issues commonly cause HTTP 403 Forbidden, it will be our primary focus when troubleshooting this error. However, we will first explore some quick possible fixes, such as clearing the browser cache or scanning for malware.

Note that while the following methods primarily address WordPress websites, they also apply to other platforms.

1. Use Hostinger AI Troubleshooter

Hostinger has a built-in AI Troubleshooter on hPanel that can help you find the root cause of the 403 Forbidden error. This tool works for WordPress websites and will suggest actions to resolve the error. Here are the steps to use the AI Troubleshooter:

  1. Open your hPanel and navigate to WordPress → AI Troubleshooter (beta).
  2. If the tool identifies the error on your WordPress site, it will automatically analyze your site. You can also see the details of when is the issue first detected.
  3. After the check, the tool will provide you with the suggested action. For example, if the wrong file permissions cause the 403 error, it will suggest you reset the permissions.
  4. Click the Fix my website button to initiate the corrective action.
Hostinger AI Troubleshooter panel, with an identified 403 error
  1. The tool will give you a confirmation message when it has fixed the website. Visit your site to check if the error is resolved. If not, you can click the Try another solution button to let the AI work out another solution.

2. Clear Your Browser Cache and Cookies

The purpose of the cache is to speed up website loading on future visits. However, if the link changes, it can cause a mismatch with the cached version and trigger an error.

Another potential cause is an issue with browser cookies. It’s possible to suddenly encounter the 403 Forbidden error on a website you log into regularly.

Clearing your browser’s cache and cookies can sometimes resolve this issue. This forces the browser to re-request all the site files and log you out from all websites.

Follow these steps to clear cache and cookies on Google Chrome:

  1. Click on the three-dot icon in the top right corner and select Settings.
  2. Locate Privacy and securityClear browsing data.
Clear browsing data highlighted in Google Chrome's privacy and security settings.
  1. Use the drop-down menu to choose the time range. We recommend choosing All time. Then, select Cookies and other site data and Cached images and files.
  2. Click Clear data.
Clear browsing data settings - time range, browsing history, cookies and other site data, and cached images and files.

After completing these steps, try revisiting and logging into the website to see if the error is solved.

3. Scan for Malware

If your WordPress site is infected with malware, it can continuously inject unwanted code into the .htaccess file, causing the 403 Forbidden error. Therefore, the error will persist even if you try to fix the .htaccess file.

If you host your website with Hostinger, you can remove malware in WordPress using our malware scanner. This automated tool can scan your websites for harmful or compromised files.

Hostinger web hosting banner

To access it via hPanel, navigate to Security → Malware Scanner.

Malware Scanner highlighted on the hPanel left sidebar menu.

If no malware was found, this section will display your hosting plan’s name and the time since the last scan.

Malware scanner tool found no malware in a website.

If suspicious files are found, the malware scanner will show a summary of detected and cleaned malware in the period of time.

Alternatively, use a WordPress malware scanner plugin to identify malicious software on your website. Numerous WordPress plugins offer this feature, such as Sucuri and Wordfence.

Wordfence - protect your websites with the best WordPress security available.

Wordfence can scan your website, identify all infected files, and give you actionable options such as deleting or restoring them.

If the 403 error persists yet your website is confirmed malware-free, proceed to the next method.

4. Check the .htaccess File

.htaccess is a server configuration file that primarily works by altering Apache Web Server settings. It is located in your website’s public_html directory.

For Hostinger customers, follow these steps to locate and create a new .htaccess file in hPanel. If you’re using cPanel, the steps should be similar:

  1. Find the File Manager on the hPanel dashboard.
File Manager highlighted on the hPanel left sidebar menu.
  1. Open the public_html directory to find the .htaccess file
.htaccess file location in hPanel file manager
  1. Right-click on the .htaccess file and select Download to create a backup.
.htaccess file, showing where to find the download option.
  1. After downloading the backup, delete the current .htaccess file in File Manager.
  2. Create a new server configuration file by clicking New file and naming it .htaccess without any extensions.
Create a new .htaccess file.
  1. Copy the following code to the fresh file, then save it.
# 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]

Alternatively, follow these steps for WordPress websites:

  1. Log in to your WordPress dashboard and select Settings → Permalinks.
  2. Click the Save Changes button at the bottom of the page without making any changes. It will generate a new .htaccess file for WordPress sites.
WordPress dashboard, highlighting the Save Changes button.

Try to access your web address again. If the 403 Forbidden error disappears, it means the .htaccess server configuration file was corrupted.

5. Reset File and Directory Permissions

Websites come with unique file permissions that control how users can read, write, and execute data. If misconfigured, it can cause HTTP 403 errors.

If you use Hostinger, a helpful hPanel tool lets you fix file permission issues with a single click:

  1. Open hPanel and go to Websites → Manage.
  2. Enter “Fix File Ownership” in the search bar and select it.
  3. Select the checkbox and click Execute. The tool will automatically assign default permissions to all website files and folders.
The Fix File Ownership screen in hPanel.

Alternatively, configure an FTP client like FileZilla to manually reset file and folder permissions. Follow these steps:

  1. Make sure FileZilla is connected to your website.
  2. Right-click on the public_html directory and select File Attributes.
Screenshot from the FTP client showing where to find public_html file and File Attributes.
  1. In the Numeric value field, enter 755. Select Apply to directories only, and click OK.
Screenshot from the FTP's file attributes showing the numeric value at 755 and the apply to directories only option.
  1. After changing directory permissions, repeat steps 2 and 3, but this time, enter 644 in the Numeric value field and select Apply to files only.
Screenshot from the FTP's file attributes showing the numeric value at 644 and the apply to files only option.

After fixing file permissions, try accessing your website to check if the error message persists.

6. Disable WordPress Plugins

If the previous methods don’t work, it’s time to check whether an incompatible or problematic WordPress plugin is causing the 403 Forbidden error.

We recommend disabling all plugins at once before deactivating them individually. This will help identify the problem and guide you toward the appropriate solution. Here are the steps to follow:

  1. Access your website’s directories via FTP or File Manager.
  2. Navigate to public_html → wp-content.
  3. Find the plugins folder.
Plugins folder location in hPanel's file manager.
  1. To disable all plugins in the folder, rename it to disabled-plugins. Now, try accessing your website. If the error no longer appears, a problematic plugin is the root cause of the issue.
Disabled-plugins folder in hPanel's file manager.
  1. Revert the folder’s name to plugins to re-enable all plugins.
  2. Disable the plugins one by one from your WordPress dashboard and check if the site functions correctly. This step will help pinpoint the faulty plugin.
  3. Once identified, update the plugin or consider deleting it to fix the issue.

7. Upload an Index Page

Check your website’s homepage name – it should be named index.html or index.php.

If not, you have two possible fixes. The simplest method is to rename the homepage as index.html or index.php via FTP or File Manager.

If you prefer not to rename the homepage, the alternative is to upload an index page to your public_html directory and create a redirect to your existing homepage. Follow these steps:

  1. Access your website files using File Manager or an FTP client.
  2. Upload a new file named index.html or index.php to your public_html directory.
  3. Open the .htaccess file.
  4. Insert the following code snippet to redirect index.php or index.html to your existing homepage. Be sure to replace homepage.html with the actual name of your page.
Redirect /index.html /homepage.html

After configuring web server settings, try to access your website’s homepage to see if the problem is resolved.

8. Edit File Ownership

Incorrect file ownership can trigger the 403 Forbidden error, particularly in Linux-based computers or VPS hosting. If you’re using a VPS with SSH access, you can modify file ownership by connecting your VPS to an SSH terminal emulator like PuTTY.

Once connected, check the ownership using the following SSH command:

ls -l [file name]

The result will resemble the following:

-rwxrw-rw- 1 [owner][group] 22 Sep 22 10:00 filename.txt

Pay attention to the owner and group sections. The correct ownership should match your hosting account’s username. If not, utilize the chown Linux command to adjust file ownership.

Here’s the basic syntax for the chown command:

chown [owner][:group] [file name]

For example, if your username is John, you would use the command below:

chown John filename.txt

9. Verify the A Record

The 403 Forbidden error can happen when your domain name points to an incorrect IP address, denying you access even with valid credentials. To prevent this, make sure that your domain name points to the correct IP address.

For Hostinger customers, follow these steps to check if the domain A record is pointed correctly:

  1. From the hPanel dashboard, navigate to the Advanced section and click on DNS Zone Editor.
The DNS Zone Editor button on hPanel.
  1. You will find a list of DNS records. Locate the A records by scanning the Type column.
  2. Examine the IP addresses in the Content column.
List of DNS records.
  1. If it’s pointing to the wrong IP address, click Edit to modify it. Once you’re done, click Update.

If you can’t locate the correct record, create a new one in the Manage DNS Records section. Select A as the Type and input the valid IP address in the Points to field. Then, click Add Record.

Add a new A Record in hPanel.

10. Update Nameservers

If you’ve recently migrated from one hosting provider to another and forgot to update your nameservers, your domain may still be pointing to your old host. Once the old host cancels your account, it can lead to a 403 error status code.

To resolve this, you must quickly update your domain’s nameservers so that it points to the new hosting provider’s server.

403 Forbidden Error Prevention and Best Practices

Preventing the 403 Forbidden error ensures a smooth operating website. Implement the following best practices to minimize the risk of encountering this error code in the future.

Perform Regular Security Audits

Regular security audits are fundamental for maintaining a secure website. They help you identify vulnerabilities and address potential issues before they lead to the 403 Forbidden error or other security issues.

Security audit usually includes reviewing file and folder access permissions, access controls, server configurations, and the status of security plugins.

Configure your file and directory access rights properly and set up a strong authentication system. Moreover, keep an eye on your .htaccess server configuration file to ensure it’s safe from unauthorized changes.

Document Access Controls and Permission Settings

Access control documentation involves maintaining records of website access and permissions. Keep an up-to-date list of user roles with clearly defined permissions, including administrators, editors, contributors, and subscribers.

Furthermore, document the permission settings for files, directories, and plugins. It includes specifying who can read, write, and execute these resources.

By documenting access controls and permissions, you ensure that only authorized individuals have access to sensitive areas of your site, helping prevent 403 and other errors.

Keep the Web Server Software and Applications Up to Date

Web application maintenance involves regularly updating your website’s software, including your web server, content management system (CMS), plugins, and other applications.

Web servers – Apache, NGINX, or LiteSpeed – is the backbone of your website’s functionality. Updating website server software to the latest stable version is crucial for security and performance.

Keeping your CMS, plugins, and applications up to date is equally important. Outdated applications can introduce vulnerabilities and compatibility issues, possibly leading to the 403 Forbidden error.

Conclusion

Encountering the 403 Forbidden error can be frustrating as it disrupts your website’s functionality. Luckily, this comprehensive guide has equipped you with the knowledge and solutions needed to overcome the issue also known as the 403 Access Denied error.

Several causes, such as incorrect file permissions, a corrupted .htaccess file, a missing index file, faulty plugins, IP blocking errors, or malware infection, can trigger this HTTP error.

To recap, here are ten effective methods you can use to resolve the 403 error:

  1. Use Hostinger AI Troubleshooter
  2. Clear the web browser cache.
  3. Scan and remove any malware.
  4. Check the .htaccess file.
  5. Restore the site’s file permissions.
  6. Disable WordPress plugins.
  7. Upload an index page.
  8. Modify file ownership.
  9. Verify the A record.
  10. Update nameservers

Prevention and proactivity is key. To avoid encountering this error in the future, conduct regular security audits, document access controls, and keep web server software up-to-date.

The 403 status code is just one of many client-side errors you may encounter. We recommend that you continue learning about these errors to understand how to handle them should they appear on your website.

403 Forbidden Error FAQ

This section will answer the most common questions about the 403 Forbidden error.

Can a 403 Error Be Caused by Incorrect File Permissions?

Yes. When file and directory permissions are misconfigured, certain websites block access to particular resources, resulting in an authentication failure that prevents users from viewing or accessing specific files or directories. Configuring the ideal file permissions is essential to avoid the 403 error.

Can Server Misconfigurations Cause a 403 Error?

Yes. Misconfigured web servers may restrict access to certain resources, resulting in a 403 Forbidden error. Common misconfigurations include .htaccess file issues or server settings that prevent users from accessing specific web content.

Is It Possible to Customize the 403 Error Page?

Yes. Website administrators can create a custom error page to offer a more user-friendly and informative message when a 403 Forbidden error occurs. This approach can also provide specific instructions to resolve this permission error.

Author
The author

Ariffud Muhammad

Ariffud is a Technical Content Writer with an educational background in Informatics. He has extensive expertise in Linux and VPS, authoring over 200 articles on server management and web development. Follow him on LinkedIn.