Home
/
Website Help
/
HTTP Status Codes
/
How to Fix the HTTP 405 Method Not Allowed Error

How to Fix the HTTP 405 Method Not Allowed Error

An HTTP 405 Method Not Allowed error can be annoying to stumble upon. As it prevents accessing a particular resource or form submission, it can push visitors away from your site. Unfortunately, the error only suggests there is an issue on your site. Yet, it doesn’t shed any light on the underlying reason.

In this guide, we’ll delve into what does response 405 mean, how to solve it on your WordPress site, and what triggers it. Read on to learn how to fix the 405 HTTP status effectively and get your WordPress back up and running!

The 405 method not allowed is an HTTP status code from the 4xx branch, indicating client-side error responses. In particular, a 405 response code means that the request’s HTTP method is not supported on the server or the resource itself.

In this context, a client usually is a browser, and the server rejects its request. That leads to the display of the 405 HTTP status code when you access a resource via your browser.

HTTP response 405 definition

The HTTP 405 status code indicates that the server has received your request, but the resource you are requesting doesn’t support the request method. This may occur if you’re using an incorrect method or the server is configured to disallow the said method.

When this happens, your browser displays the 405 HTTP code response in the following error message variations:

  • HTTP 405 Method Not Allowed
  • HTTP Error 405 – Method Not Allowed
  • Method Not Allowed
  • 405 Not Allowed
  • HTTP Error 405

Most commonly, this client error appears in your browser, as shown in the screenshot below.

Screenshot of the HTTP 405 Method Not Allowed error in the browser

What are HTTP methods?

HTTP methods (a.k.a HTTP verbs) are actions performed on resources identified by Uniform Resource Identifiers (URIs). A URI serves as a kind of address for the resource, allowing it to be located and retrieved from anywhere in the world.

The most common HTTP methods are explained in the table below.

Method Description
GET retrieves a representation of a resource
POST sends data to be processed to a resource
PUT updates a resource with new data
DELETE deletes a resource
HEAD retrieves the header information of a resource
OPTIONS retrieves the supported methods and other options for a resource
CONNECT creates a network connection to a resource
TRACE retrieves a diagnostic trace of the actions performed by a resource
PATCH applies partial modifications to a resource

The HTTP methods a resource supports are usually specified in an ‘Allow’ header. It defines which HTTP methods are allowed. For example, if a resource only allows the GET and POST methods, the server would include an Allow header in its response that specifies those methods.

The absence of HTTP methods in the Allow header suggests that the requested resource does not support any request methods. That could be a temporary situation for a particular resource.

Now that you know what is the HTTP status 405 method not allowed error, keep reading to learn how to diagnose and solve it effectively.

Troubleshooting Prerequisites

As a rule of thumb, you should always backup your site before troubleshooting errors or making significant changes.

Backup your WordPress site

Before diving into troubleshooting an HTTP 405 response in WordPress, it is vital to generate a website backup. A WordPress backup allows for easy reversal of any changes made during troubleshooting.

Additionally, it helps prevent the loss of essential data and information in case any unforeseen issues arise.

SiteGround clients can use the Backup tool in their Site Tools to swiftly generate a WordPress backup.

Create a Staging for your WordPress

Alternatively, you can create a staging environment for your WordPress website. Staging is a separate environment to test changes and modifications without affecting your live site. That allows you to work on the troubleshooting process without worrying about breaking your live website.

Once you have successfully fixed the method not allowed 405 error, you can push the changes to your live site.

Having clarified the troubleshooting preparations, we can get on with how to fix an HTTP 405 error, so read on.

How to fix HTTP error 405? (10 Fixes)

Fix 1: Double Check the URL

More often than not, a simple typo can cause the HTTP 405 status. A wrong URL entered in your web browser’s address bar may prevent your access to a specific web page. Thus, to rule out this possibility, first, double-check if you are typing the URL correctly.

When you are confident that your URL is correct, try accessing the resource once more to see if that solves the 405 HTTP status.

Fix 2: Check your domain’s DNS

In case your URL is correct, but you still see a 405 HTTP code, maybe the problem arises from a domain’s misconfigured DNS. If a domain points to an incorrect server or is still in DNS propagation, it can cause a 405 error code.

The easiest way to test if your domain points to the correct DNS server is by using an online checker. Plenty of free web DNS checkers like the Google Admin Toolbox help you dig within global records for your domain.

Screenshot of the Google Admin Toolbox showing how to enter a domain and select the type of record to resolve

Load the web tool, then type your domain name in the designated “Name” field and select the type of record you want to check.

Provided that your domain points to the correct DNS, keep reading the following steps to solve the HTTP error 405.

Fix 3: Fix WordPress file and folder Permissions.

Incorrect file and folder permissions can cause a 405 Method Not Allowed response for WordPress if the server cannot execute certain operations. Due to insufficient permissions, web servers might not execute tasks like uploading media files, updating plugins/themes, or creating cache files.

The access permissions define who and how can operate your WordPress files and folders. In particular, the permissions define which user group can read, write, or execute files/folders. In terms of WordPress, files and folders are those for your content, like plugins, themes, or media.

If their permissions are misconfigured, you’ll get “the server responded with a status of 405 method not allowed” error.

SiteGround default permissions setup is 755 for folders and 644 for files since this is considered best practice. Thus, you must ensure your WordPress permissions comply.

SiteGround clients can fix WordPress permissions from their SiteTools > WordPress > Install & Manage. When in there, click on the kebab menu next to your site and select Reset Permissions.

Screenshot of how to use the Reset Permissions tool in Site Tools to solve the HTPP 405 Method Not Allowed error

A pop-up window will appear where you confirm the permissions reset for all your WordPress files and folders recursively.

Screenshot showing the Reset Permission confirmation pop-up

Alternatively, you can fix your WordPress permissions via FTP.

After that, retry accessing the intended resource, and if the 405 status error is gone, incorrect permissions were at fault.

Fix 4: Deactivate newly installed plugins and themes.

Sometimes, newly installed plugins or themes can conflict with the server or your web application and cause HTTP error 405. To fix this, deactivate any freshly installed plugins or themes and try reaccessing the page. This way, you can conclude whether the error is caused by one of them.

If the error disappears after deactivating the newly installed plugin or theme, then you have identified the cause of the problem.

In case that doesn’t fix the error, you may need to deactivate all plugins or try changing your WordPress theme to a default one.

Fix 5: Inspect the latest database changes

Unfortunately, disabling faulty plugins does not remove all the changes they did to your WordPress database. Many plugins leave leftover tables in your database that may cause a conflict, resulting in an HTTP 405 status code.

You can access your website’s database through your web hosting control panel or using an FTP client to connect to your server. SiteGround clients can access their database using the PHPMyAdmin software from Site Tools > Site > MySQL.

Screenshot showing how to access PHPMyAdmin from your Site Tools MySQL Manager

Inside, look for any leftover database tables from uninstalled plugins and remove them. Also, you should check the wp_posts, wp_options, wp_plugins, wp_users, and wp_usermeta tables for any recent changes that may have caused the 405 error. If you find such changes inflicted by a plugin or theme, revert them to try resolving the problem.

Fix 6: Check your Server configuration and .htaccess file.

An HTTP error 405 means that the server configuration refuses access to a resource (URI) due to HTTP method restrictions. Thus, you should inspect your configuration file for any unintended request handling rules or redirects causing the issue.

To figure out which is the configuration file for your web hosting server, you need to know what is the server configuration. Usually, the config file for web server software based on Apache is .htaccess. While those servers using NGINX rely on the nginx.conf file for configuration directives.

SiteGround servers are configured to work with both Apache and NGINX, and the configuration file to use is the .htaccess, located in your root directory.

When checking your web server’s .htaccess, ensure no Rewrite rules are flagged with a 405 handler. Such flags result in a particular request being handled with a 405 HTTP response code. Remove the rules containing similar flags and test to see if the error is resolved.

Fix 7: Examine your server logs.

Combing through your server-side logs can help you pinpoint the root cause of the 405 HTTP status. Generally, there are two types of server logs: access logs and error logs.

The Access logs store entries for all requests and responses a server handles for a website. They hold information for the HTTP status codes, the URLs accessed, the client’s IP addresses, etc. Reading through these logs, you can locate any rejected requests with “failed to load resource: the server responded with a status of 405 (method not allowed)”.

Another set of logs is the Error log, where you can find a list of entries for failed operations. This includes errors generated by the server and the application code running on the server. By examining the entries in the server error log, you can identify the 405 HTTP code error that occurred and find the root cause of the issue.

Fix 8: Enable WordPress Debug Mode

The WordPress debug mode is a built-in feature that provides detailed information on errors occurring within a WordPress site. The debug mode is one of the application logs, and when enabled, WordPress shows error messages and warnings that are normally hidden. That can help you identify and resolve issues like the method not allowed 405.

Add the following line of code to your site’s wp-config.php file to enable WordPress Debug mode.

define( 'WP_DEBUG', true );
Screenshot of the Enable Debug mode definition in wp-config.php

Once debug mode is enabled, WordPress displays error messages and warnings on the site’s pages and the server error log. When the 405 error occurs, the debug mode can display detailed information about the error. That includes the specific HTTP method used in the request and any other relevant details about the request and response.

You must use WordPress debug mode with caution in a production environment. When debug mode is active, WordPress may display sensitive information about the site’s configuration and functionality. Thus, disabling the debug mode is crucial once the issue is resolved.

Fix 9: Roll back recent WordPress updates.

Rolling back recent WordPress updates may help resolve an HTTP 405 status code if the update caused a conflict with the server or the application code. That involves rollbacking to a previous version of WordPress or specific plugins or themes that may be causing the 405 error.

If you suspect a plugin or a theme you’ve recently updated may be causing the issue, try reverting the update. You can quickly revert the WordPress plugin and theme updates using the WP Rollback plugin.

Remember that you must regularly update your WordPress plugins, themes, and core to ensure their compatibility and maintain the website’s security.

  • Rollback Plugins

To roll back a plugin version, login to your WordPress Dashboard and navigate to the Plugin section. Next to each plugin in the list, you’ll find the Rollback button.

Screenshot on how to revert a plugin update with the WP Rollback plugin

Clicking it will prompt you to select a specific version you want to revert to. Select your preferred version, and WP Rollback will handle it.

Screenshot of selecting a preferred version to revert to with the WP Rollback plugin
  • Rollback Themes

If you want to revert a theme’s version, navigate to Appearance > Themes and click on Theme Details for the one in question. This will load a window with the theme’s details, and on the bottom right side, click the Rollback button.

Screenshot of how to revert a theme update with the WP Rollback plugin

Same as with plugin version reverts, WP Rollback will allow you to choose which version you want your theme reverted to.

In case the HTTP status 405 method not allowed was due to a conflicting update, reverting it should solve the error.

Fix 10: Restore WordPress from a backup

HTTP 405 status code indicates that the server has received a request method that is not supported for the target resource. Restoring WordPress from a backup can help resolve the error if corrupted files or misconfigured settings cause it.

If you are a SiteGround user, you can restore your site swiftly using our Backup Restore tool in the Site Tools > Security section.

Screenshot of the Backup tool in Site Tools Restore all files and databases to fix the HTTP 405 Method Not Allowed

Select the date you want to restore from and hit the kebab menu to select Restore All Files and Databases.

If the issue was due to missing or corrupted files or other misconfigurations, restoring an error-free version should fix the 405 HTTP code.

What causes the HTTP 405 error in WordPress?

In short, here are the most common triggers for the HTTP 405 method not allowed error in WordPress.

  • Plugin or theme conflicts – If a plugin or theme modifies the WordPress code, resulting in conflicts, it can cause an HTTP 405 error that prevents the server from accepting specific HTTP methods.
  • Permissions issues – Improper permissions for files or directories can cause the server to deny specific HTTP methods, leading to a 405 error.
  • Outdated core, plugins, or themes – Out-of-date WordPress core files, plugins, or themes may have compatibility issues with newer HTTP methods, leading to a 405 error.
  • Corrupted database – A corrupted database can cause the server to deny HTTP methods, leading to a 405 error. That can occur if the database is not well-optimized or if there is a hardware failure.
  • Incorrect WordPress settings – Incorrect server settings or WordPress configuration can lead to a 405 error when the server cannot handle particular HTTP methods.
  • Missing or corrupted WordPress files – If core WordPress files are missing or corrupted, the server may be unable to handle certain HTTP methods, causing a 405 error.

Conclusion

In conclusion, encountering the HTTP 405 Method Not Allowed error can be a frustrating experience. But following the 10-fix troubleshooting path outlined in this article, you can quickly fix the error. Resolving it will help ensure your website serves pages correctly to users and search engines.

Remember to check for conflicts with plugins or themes, verify file permissions, and examine your database and server logs. By taking these steps, you can fix the HTTP 405 error and provide your website visitors with a seamless browsing experience.

In case you tried all the fixes to solve the 405 status code to no avail, reach out to your hosting support for help.

Share This Article