A 405 Method Not Allowed error means the server recognises the URL but does not accept the HTTP method used to request it, for example a POST sent to a static file or a DELETE to an endpoint that only supports GET. The fix depends on whether the problem is the client, the application or a server rule.
Before you start
- The URL and the method used (check the browser's developer tools → Network tab).
- cPanel or SSH access to read logs and
.htaccess.
Common causes of a 405 error
- A form posting to the wrong URL, such as an
.htmlpage that cannot process POST data. - A redirect in the middle: a 301 redirect turns a POST into a GET, and the next request hits a route that only accepts POST.
- API routes that only define certain methods (common in Laravel, Express and REST plugins).
- Rewrite or security rules that limit methods with
<Limit>,<LimitExcept>or a WAF rule. - Static file requests with POST, which many web servers answer with 405.
How to fix a 405 Method Not Allowed error
- Confirm the method. Reproduce the request with
curl -i -X POST https://example.com/pathand compare it with aGET. - Check the form action. Make sure
<form action>points to the script that handles it (for examplecontact.php), using the final URL with the correct scheme,wwwchoice and trailing slash so no redirect happens. - Check the application routes. In frameworks, list the routes and confirm the method is defined for that path.
- Review
.htaccess. Search forLimit,LimitExceptorRewriteCond %{REQUEST_METHOD}lines and remove rules that block methods you need. Our .htaccess troubleshooting guide covers safe editing. - Check the logs. cPanel → Metrics → Errors and the raw access log show the method and status code for each request.
- Rule out security filters. If the response page mentions a firewall or ModSecurity, open a ticket with the time and URL so support can review the rule.
Tip: A POST that is redirected (HTTP to HTTPS, or non-www to www) usually arrives as a GET. Always post to the exact final URL.
What to check afterwards
Resubmit the form or rerun the API call and confirm the response is 200 or 201. In the access log the request should show the method you expect with no 301 before it.
FAQ
Is a 405 error a server problem?
Not usually. The server is working; it is the method that is not accepted on that URL.
Why do I get 405 after moving to HTTPS?
Forms still post to http://, get redirected and lose the POST method. Update the form action to https://.
How is 405 different from 404?
404 means the URL does not exist; 405 means it exists but not for that method.
