How to fix "405 error"

How to fix “405 error”

Spread the love

In this tutorial, we will explain more about the 405 website error and how to fix it.

A 405 error is an HTTP not allowed error that prevents visitors from accessing the content of your website. The result of this error is a blank page and can be caused due to several reasons. If not resolved on time this can cause visitors to leave. Inevitably this damages your website reputation which may lead to a loss of sales.

In the next paragraphs, we will explain the reasons and possible solutions for fixing this error.

The 405 Not Allowed error can be tricky to identify quickly. Typically there’s only a blank page with the message at the top. We need to go through some checks which may take ten minutes to get our website up and running again.

Wrong URL

It’s easy to enter a long URL incorrectly which may lead to a 405 Not Allowed error. Try accessing the website homepage first. See if it is accessible and if so try to access the specific page you need. Checking the URL is so simple that sometimes we forget to do it, but it can solve our issue immediately.

Database Changes

If you use CMS websites with plugins such as WordPress, Drupal, or Joomla plugin updates can change your database. Before updating, it is necessary to have a database dump. In most cases, the database tables are changed by some plugins with full access to our database. Even if you uninstall the plugins, the database changes would not be reverted. One possible solution would be for the developer to modify them manually. It is recommended to have a database backup before doing anything to prevent such a scenario.

Web server configuration

If are using Apache as a web server, check the configuration of .htaaccess. We should consider the rewriting rules, limited directives, and who can access the website. If you are using Nginx, the configuration is in the Nginx virtual host file. You should check the Nginx location blocks, and the error page directives. This way you can make the changes, restart the web services, and see if that will fix the issue.

Files and Folder permissions

Uploading files in your website’s root directory with the root user can cause it to be inaccessible due to permissions. Always upload files and folders with the user who is the owner of the website’s root directory. However, if there are incorrect files and folder permissions we can fix them with the following commands:

chown www-data:www-data  -R .         # If the Apache or Nginx are owners
find . -type d -exec chmod 755 {} \;  # Directory Permissions
find . -type f -exec chmod 644 {} \;  # Files Permissions

Check the Code

You have to check if there are any hard-coded lines in your code. In addition, you should check your submitting forms, the GET, and the POST requests. Finally, check if some of the libraries in the website framework are using inconsistent methods rejected by the server. The developer should enable the debug mode and perform unit tests to find the issue.

Rollback any Updates

If your website was accessible before any plugin updates, the 405 Not Allowed method may be caused by the update. You should roll back the plugin update and see if that will fix the issue. If the issue is due to changed code, simply revert the lines of the changes and restart your web service.

Restore the whole Website

Finally, you can restore the website from our daily, weekly, or the whole backup made before any minor changes. This way we are sure that we will not lose time for debugging, and will fix the issue immediately. If your hosting provider offers managed services, contact their support to restore the website from a backup. If you have a bare-metal unmanaged server, you can always contact our technical support. We will help you with any aspect of your website. We are available 24/7.

These were some basic steps to solve the 405 Not Allowed error. If you liked this post on how to fix the 405 error, please share it with your friends. You can also leave a comment below.

Leave a Reply

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