How to Fix HTTP Error 405 Method Not Allowed
When a website displays the 405 Method Not Allowed notification, it indicates a Hypertext Transfer Protocol (HTTP) error. It prevents visitors from accessing the website’s content, which can cause visitors to lose trust in your brand.
However, the notification only indicates the 405 Method Not Allowed error and does not explain why it occurred. As a result, you may need to try a variety of solutions to resolve this issue.
As a result, we will share the 11 solutions to this problem, such as reverting recent updates and checking the web server configuration.
Let’s start by defining the 405 Method Not Allowed error page.
|Error code||405 Method Not Allowed|
|Error type||Client-side error|
|Error variations||HTTP Error 405 – Method Not Allowed|
HTTP 405 Method Not Allowed
405 Not Allowed
Method Not Allowed
HTTP Error 405
|Error causes||Wrong URL input|
Platform, theme, or plugin update issues
What Is the 405 Method Not Allowed Error
The 405 Method Not Allowed error occurs between a client and a server. This message indicates that the web server has recognized a request from a web browser to access the website but rejects the specific HTTP method.
Since the web browser cannot access the requested page, it will show an error message instead. The 405 Method Not Allowed error message is an HTTP response status code. There are different categories to indicate whether a specific HTTP request is complete:
- 1xx status responses – informational requests.
- 2xx status responses – successful requests.
- 3xx status responses – redirection messages.
- 4xx status responses – client errors.
- 5xx status responses – server errors.
So, the 405 Method Not Allowed is often caused client-side. However, it can also mean that the error is caused by web servers’ responses to clients. This client error can appear in different ways:
- HTTP Error 405 – Method Not Allowed
- HTTP 405 Method Not Allowed
- 405 Not Allowed
- Method Not Allowed
- HTTP Error 405
Although the error page message may vary on different browsers, the steps to fix it are the same with any browser.
11 Methods to Fix the 405 Method Not Allowed Error
Identifying the exact cause of the 405 Method Not Allowed error can be difficult. To help you out, we have listed 11 ways to fix this HTTP issue.
1. Check the URL
One of the first solutions to fix this client-side error involves checking the Uniform Resource Identifier (URL). A common cause of the 405 Method Not Allowed error is inputting the wrong URL. As a result, the browser cannot open a page that does not exist.
Check for a missing letter or a misspelled word in the URL. Then, see if the web page loads correctly. Even though it might seem like a simple step, it often works.
2. Revert Recent Updates
In some cases, this error may start showing up after updating a site. To fix it, try reverting any recent updates you have made on your site, platform, extensions, modules, or plugins. Updates to any of these elements can cause server-side changes that lead to this error.
Each platform or application has its way of reverting recent updates. For example, WordPress users can use the WP Downgrade plugin to automatically downgrade their WordPress version and prevent irreversible changes.
To avoid this HTTP error notification lingering on your page for too long, always check your website after any updates.
3. Check for Database Changes
Another possible reason behind the 405 Method Not Allowed error is database changes. Some extensions have all privileges to access your database. Even uninstalling the extension might not revert the changes.
The steps to check the changes vary depending on the database. Hostinger users can access their database by following this guide:
- Head to your hPanel and click on Management under the Databases dropdown.
- Select your site’s MySQL Database and click on the Enter phpMyAdmin button on the right.
- Choose the SQL tab of your database.
- Run the following query, replacing dbname with your database name:
SELECT UNIX_TIMESTAMP(MAX(UPDATE_TIME)) AS last_update FROM information_schema.tables WHERE TABLE_SCHEMA = 'dbname' GROUP BY TABLE_SCHEMA;
- Click the Go button on the right side of the page to complete the request, and it will display when you did your last database update.
Search for tables and records that may have been tampered with by an extension. Revert any changes on the database.
We recommend consulting your web host’s support team to avoid making unnecessary modifications.
4. Uninstall New Plugins, Themes, and Extensions
When installing a theme, plugin, or extension, the website’s code may change. These changes can then cause the issue. So, if the error message starts appearing after you install a new plugin, theme, or extension, try uninstalling and reinstalling it again.
If you are using WordPress, then uninstalling plugins can be done by heading to Dashboard -> Plugins and Deactivating your newest plugins.
To deactivate a WordPress theme, head to Dashboard -> Appearance -> Themes. If you are using the newest theme, change it to another one first. Then, click on the new theme and select Theme Details. On the bottom right corner, click on the Delete button.
This step can also be done on your hosting account. For example, Hostinger users can disable WordPress plugins via hPanel:
- Head to your hPanel and go to Plugins.
- Toggle the purple button to disable the plugin.
Check if the error message still appears after you disable your newest plugin or theme. If the issue is solved, try using a different extension on your site.
5. Check Your Server-Side Logs
A web application keeps server-side logs to track the different activities and events that happen on your site. Changes in the server logs can cause the 405 Method Not Allowed message to appear on your website. Look through your server logs to ensure that all information is correct.
To access a site’s server logs, head to your root directory and look for the access.log and error.log files. Check if any of the information there seems out of place.
6. Check Your Web Server Configuration
If the 405 Method Not Allowed problem persists, take a look at your server configuration files. This error indicates that the server configuration does not allow users to access a particular Uniform Resource Identifier (URI).
Check your server software to see if there are any unintentional redirects or request handling instructions. To access your configuration files, determine which server software your website uses. The two most popular ones are Apache and NGINX.
If your server is Apache, look for a .htaccess file within your website’s root directory. If your server is running on NGINX, look for an nginx.conf file. There, search for directives that are using a 405 flag. Change the files to the original data and restart your server to check if the error has disappeared.
7. Check Your Code and Scripts
Another solution to fix this error is also by checking the website’s code and scripts. Make sure that your website is using the correct coding language.
A way to check your code and scripts involves copying the website to a local development machine and performing a debugging process that simulates the exact scenario in which the 405 Method Not Allowed occurs. This way, it will be easier to detect when exactly something went wrong.
8. Fully Restore Your Website From a Backup
In some cases, the HTTP 405 error appears due to compatibility issues. If other options have not helped solve this problem, try restoring your website using the most recent backup. The steps to restore a website using a backup depend on the platform.
With Hostinger, follow the steps below to restore your website:
- Head to hPanel and select Backups under Files.
- Click Select under Files backups.
- Select the date and click on Next step, which will load all your content from that date.
- Navigate through the folders and select which ones to restore. Click on Restore files.
- Click on Restore again, and the system will start the process and send a notification once the process is complete.
9. Check the .htaccess File
Check your .htaccess file for any entries that include 405. The 405 Method Not Allowed error message can show up on your site if you rewrite the .htaccess file incorrectly.
To investigate potential causes, go to your .htaccess file from the File Manager. Here’s how to do it if you host a WordPress site on Hostinger:
- Head to hPanel and go to File Manager.
- Click on the public_html folder and select the .htaccess file.
- Look for the lines that use Rewrite directives directing visitors to a URL. Check for [R=405].
If it is there, add a # at the end of the line. Then, refresh your website to see if this resolves the issue.
10. Fix File Ownership
Another reason why your site may experience this HTTP method error is because of misconfigured permissions. Every file and folder on your website has a set of permissions. By fixing your file ownership, you can correct any misconfigured permissions.
There are different ways to fix file ownership depending on your platform. Follow the steps below to do so on Hostinger:
- Head to hPanel and click on Fix File Ownership under Advanced.
- Tick the option that you want to set your site’s files and folders to default permissions and click Execute.
11. Check A Records
Finally, to solve this HTTP method problem, check your Domain Name System (DNS) records. Check the A records to make sure that all the details are correct. The A record is the most basic type of DNS record that points a domain or subdomain to an IP address.
The steps to access your DNS records depend on your web hosting provider. Hostinger users should access their database records by heading to hPanel -> DNS Zone Editor.
Check that your A records contain this information:
- Type – the type of DNS record should be A.
- Name – use @ if the domain or subdomain name points to another IP address.
- Points to – verify if your domain or subdomain points to the correct IP address.
- Time to Live (TTL) – how long the DNS resolver should save the query for this domain in the cache. Most hosting providers usually set it to 14400 seconds or 4 hours.
Troubleshooting Other 4xx Errors
The 405 Method Not Allowed error indicates that the server received a web browser request but rejected the HTTP method. This prevents your visitors from viewing the website’s content.
This article discussed 11 ways to resolve this issue on your website.
If none of these methods work, contact your hosting provider’s support team.
Please leave a comment below if you have any questions, feedback, or additional suggestions.
405 Method Not Allowed FAQs
If you want to know more about the topic, take a look at the following frequently asked questions.
What Causes a 405 Error?
The 405 error happens when a client attempts to use an HTTP method that is not allowed by the server. For example, this issue can occur when a user tries to use a method such as PUT or DELETE on a resource that only allows GET or POST requests.
How Can I Prevent the 405 Method Not Allowed Error?
Make sure to use the appropriate HTTP method for the resource being requested to prevent the 405 Method Not Allowed error. Check the server’s documentation to determine which methods are allowed for each resource, and ensure that requests use only allowed methods.