【问题标题】:PUT request modrewritePUT 请求 mod_rewrite
【发布时间】:2012-07-24 16:46:46
【问题描述】:

我有文件 /tm/index.php 我想用这样的规则重写:

RewriteRule ^tm/([a-zA-Z1-9]*)$ /tm/index.php?p=$1 [L]

当我尝试向重写的 url 发送 PUT 请求时,我收到 HTTP 错误:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL /tm/295014.</p>
</body></html>

我不知道该怎么做。当我调用 /tm/index.php?p=295014 它工作正常,但我不能以这种方式使用它。请帮忙修改重写规则。

【问题讨论】:

    标签: php apache mod-rewrite apache2


    【解决方案1】:

    问题与您的重写规则无关,您的index.php 未设置为接受PUT 方法。这就是 405 错误告诉您的内容。

    查看允许 PUT 请求的答案:https://stackoverflow.com/a/2935714/851273

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-07
      • 1970-01-01
      • 1970-01-01
      • 2021-02-23
      • 2018-08-02
      • 2019-05-20
      • 2017-02-19
      • 2019-09-27
      相关资源
      最近更新 更多