Free auditStart free
GuideError · HTTP status codes

405 Method Not Allowed in Apache

Fix an Apache 405 Method Not Allowed: find which of AllowMethods, TraceEnable, a static-file POST or a missing handler returned it, with curl tests and configs.

5 min
read
7
sources
Oct 31, 2026
updated
Scaplet Editorial Team
author
The short answer

In Apache, a 405 Method Not Allowed means the server understood the request method but the target resource does not support it. The common sources are a POST sent to a static file, an AllowMethods list that leaves the method out, or TraceEnable off answering a TRACE request. Send the request with curl -i, read the Allow header, then read the error log.

  1. What a 405 is, and what Apache does to produce one
  2. Reproduce it and read the Allow header
  3. Fixes by cause
  4. What it means for crawlers
30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02Check it

Reproduce it and read the Allow header

Because the server must send Allow with a 405, the response already tells you what Apache thinks the resource accepts. Start there.
Find which rule fired in the error log
# Path depends on ErrorLog; Debian/Ubuntu: /var/log/apache2/error.log
grep -E "does not accept the|Invalid method" /var/log/httpd/error_log | tail -n 10
Test each method and read Allow
# What does the resource say it supports?
curl -i -X OPTIONS https://example.com/api/orders

# Reproduce the failing call exactly as the client sends it
curl -i -X POST https://example.com/api/orders -d 'a=1'

# Look for the status line and the Allow header
# HTTP/1.1 405 Method Not Allowed
# Allow: GET,HEAD,OPTIONS
03How it works

Fixes by cause

Allow the methods an API path needs
<Location "/api/">
    # GET and HEAD count as one. Names are case-sensitive.
    AllowMethods GET POST PUT DELETE OPTIONS
</Location>

# Turn the restriction off in a nested path
<Location "/api/public">
    AllowMethods reset
</Location>
Keep the method across a redirect
# 301/302 can switch a POST to GET in the client.
# 307 and 308 keep the method and body.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/$1 [R=308,L]
Server-wide TRACE policy
# Default is on. off returns 405 to TRACE.
TraceEnable off
  1. 01

    POST to a static page: point the form at a handler

    Apache serves .html through its default handler, which refuses POST. Send the form to a script or application route that Apache hands to PHP-FPM, CGI or a proxy, not to the HTML file.

  2. 02

    AllowMethods: add the method, and OPTIONS

    Edit the list for the matching <Location>, then reload. Include OPTIONS if browsers send CORS preflight requests to the path, otherwise the preflight fails before your real request is sent.

  3. 03

    TRACE: expect the 405

    If a scanner reports TRACE, a 405 is the intended result of TraceEnable off. The Apache docs say enabling TRACE "does not expose any security vulnerability in Apache httpd", so this is a policy choice, not a fix.

  4. 04

    Reload and retest with the same curl command

    Run apachectl configtest and then apachectl graceful (or systemctl reload apache2), and repeat the failing curl -i call.

04Quick triage

What it means for crawlers

Googlebot normally requests pages with GET and HEAD, so a 405 on a public page usually means a rule is catching those methods by mistake. Google's crawling docs say all 4xx codes except 429 tell crawlers the content does not exist, and URLs that already returned content are dropped from the index over time. If a page you want indexed returns 405, check AllowMethods first and confirm GET works with curl -i. For the wider crawl effect, read 4xx errors.
Symptom

Form POST to an .html file fails

Likely cause
Default handler rejects POST
Check
Error log AH00131
Symptom

API works in curl, fails in the browser

Likely cause
Preflight OPTIONS rejected
Check
curl -i -X OPTIONS and the Allow header
Symptom

PUT or DELETE fails only on one path

Likely cause
AllowMethods list too short
Check
Config search for AllowMethods
Symptom

Security scan shows TRACE 405

Likely cause
TraceEnable off
Check
Expected; no action
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01Why does Apache return 405 when I POST to an HTML file?

Apache's default handler serves static files and, in the 2.4 source, returns 405 for a POST unless a script handler is delivering the file. It logs "This resource does not accept the POST method." Submit the form to a script or route instead.

02Is 405 the same as 403 in Apache?

No. 403 is an access-control denial. 405 means the method is known but not supported for that resource, and the response must include an Allow header.

03How do I allow PUT and DELETE in Apache?

If you use AllowMethods, list them for that location, for example AllowMethods GET POST PUT DELETE OPTIONS. If you do not, the application behind Apache (PHP, a proxy target) decides which methods it accepts, so check its routes.

04Does a 405 hurt SEO?

Only if a page you want indexed returns it to GET or HEAD. Google treats 4xx responses other than 429 as the content not existing, so a public URL that returns 405 can be dropped from the index.

Sources · 7

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • rfc-editor.org
  • apache.org
  • github.com
  • mozilla.org
  • google.com
  1. 01RFC 9110: HTTP Semantics, 15.5.6 405 Method Not Allowedrfc-editor.org · checked 2026-11-01
  2. 02Apache httpd 2.4: mod_allowmethodshttpd.apache.org · checked 2026-11-01
  3. 03Apache httpd 2.4: core features (TraceEnable, Limit, LimitExcept)httpd.apache.org · checked 2026-11-01
  4. 04Apache httpd 2.4 source: server/core.c default_handlergithub.com · checked 2026-11-01
  5. 05Apache httpd 2.4: RewriteRule flagshttpd.apache.org · checked 2026-11-01
  6. 06MDN: 301 Moved Permanentlydeveloper.mozilla.org · checked 2026-11-01
  7. 07How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-11-01
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane