# 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.

Canonical: https://scaplet.com/errors/http/405/apache

Guide Error · HTTP status codes

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

405 4xx · Client error

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](#what-a-405-is-and-what-apache-does-to-produce-one)
2. [Reproduce it and read the Allow header](#reproduce-it-and-read-the-allow-header)
3. [Fixes by cause](#fixes-by-cause)
4. [What it means for crawlers](#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 with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F405%2Fapache%20(%22405%20Method%20Not%20Allowed%20in%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F405%2Fapache%20(%22405%20Method%20Not%20Allowed%20in%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F405%2Fapache%20(%22405%20Method%20Not%20Allowed%20in%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F405%2Fapache%20(%22405%20Method%20Not%20Allowed%20in%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

_01_Where Apache itself returns 405

## What a 405 is, and what Apache does to produce one

RFC 9110 defines 405 as a method that "is known by the origin server but not supported by the target resource", and requires the server to send an `Allow` header listing the methods the resource supports. The general meaning is on [405 Method Not Allowed](/errors/http/405). This page covers the places inside Apache httpd 2.4 that return it.

Source

### Default handler (static files)

Trigger

A POST to a file Apache serves as plain content, such as `form.html`. The source comment says the only possible non-GET method at that point is POST, and it logs `This resource does not accept the POST method.` (AH00131)

How to confirm

`curl -i -X POST https://example.com/form.html` returns 405; the error log has AH00131

Source

### `AllowMethods` (mod_allowmethods)

Trigger

A method not in the list for that `<Location>` or `<Directory>`. The module is marked Experimental and lists case-sensitive methods; GET and HEAD are treated as equivalent

How to confirm

`apachectl -t -D DUMP_MODULES` shows `allowmethods_module`; search the config for `AllowMethods`

Source

### `TraceEnable off`

Trigger

Any TRACE request. The docs: it "causes the core server and mod_proxy to return a 405 (Method not allowed) error"

How to confirm

`curl -i -X TRACE https://example.com/`

Source

### Unknown or unsupported method on a resource

Trigger

In the default handler, a method other than GET or POST that is not OPTIONS ends in a 405. A method Apache does not recognize at all is logged as `Invalid method in request` and returns 501

How to confirm

Compare the status: 405 means a known method, 501 means an unknown one. See [501](/errors/http/501)

A 405 is not a 403. A 403 comes from access control (`Require`, file permissions) and says you may not do this. A 405 says this resource does not do that method at all. If your `<Limit>` block is the suspect, note that Apache documents it as restricting access controls, so a denied method there normally ends as a 403, not a 405. See [403 Forbidden in Apache](/errors/http/403/apache) for that case.

_02_Check 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
```

**A redirect can turn your POST into a GET**If a 301 or 302 sits in front of the endpoint (for example an `http` to `https` or a trailing-slash rule), the browser follows it with GET. MDN notes that in the Fetch Standard a 301 in response to a POST is followed with GET. The GET then hits a POST-only route and returns 405. Call the final URL directly with `curl -i`, or use `R=307`/`R=308` so the method is kept.

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
```

_03_How 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
```

**AllowMethods is documented as experimental**The Apache page marks `mod_allowmethods` as Experimental and says it "was written to replace the rather kludgy implementation of Limit and LimitExcept". It is also not available inside `.htaccess` (the documented context is directory). If a shared host only gives you `.htaccess`, `<LimitExcept>` is the documented alternative, but it applies access controls, so expect 403 rather than 405.

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](/glossary/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.

_04_Quick triage

## What it means for crawlers

[Googlebot](/ai-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](/seo-issues/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.

_01_ Why 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.

_02_ Is 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.

_03_ How 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.

_04_ Does 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. 01 [RFC 9110: HTTP Semantics, 15.5.6 405 Method Not Allowed](https://www.rfc-editor.org/rfc/rfc9110.html#name-405-method-not-allowed) rfc-editor.org · checked 2026-11-01
2. 02 [Apache httpd 2.4: mod_allowmethods](https://httpd.apache.org/docs/2.4/mod/mod_allowmethods.html) httpd.apache.org · checked 2026-11-01
3. 03 [Apache httpd 2.4: core features (TraceEnable, Limit, LimitExcept)](https://httpd.apache.org/docs/2.4/mod/core.html) httpd.apache.org · checked 2026-11-01
4. 04 [Apache httpd 2.4 source: server/core.c default_handler](https://github.com/apache/httpd/blob/2.4.x/server/core.c) github.com · checked 2026-11-01
5. 05 [Apache httpd 2.4: RewriteRule flags](https://httpd.apache.org/docs/2.4/rewrite/flags.html) httpd.apache.org · checked 2026-11-01
6. 06 [MDN: 301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301) developer.mozilla.org · checked 2026-11-01
7. 07 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-11-01

## Keep learning

[All errors](/errors)

[Learn HTTP 405 Method Not Allowed HTTP status codes](/errors/http/405) [Related 4xx errors Status codes and links](/seo-issues/4xx-errors) [Read next 405 Not Allowed in nginx HTTP status codes](/errors/http/405/nginx) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 405 errors
[405 Not Allowed in nginx](/errors/http/405/nginx) [HTTP 405 Method Not Allowed](/errors/http/405)

Nearby in errors
[404 Not Found in WordPress](/errors/http/404/wordpress) [406 Not Acceptable](/errors/http/406)

More in HTTP 405 Method Not Allowed
[405 Method Not Allowed in Apache](/errors/http/405/apache) [405 Not Allowed in nginx](/errors/http/405/nginx)

Terms on this page
[CORS](/glossary/cors)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

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

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
