首页 > 解决方案 > 405 在 Apache 身份验证中不允许获取

问题描述

我正在尝试为我的本地主机 Web 服务器创建一个身份验证表单,每次我试图让它工作时,我都会收到这个错误:

Method Not Allowed 请求的方法 GET 不允许用于此 URL。

好吧,我知道它不能考虑,但我真的不知道如何解决这个问题,我没有找到任何例子。任何帮助将不胜感激。

访问:

SetHandler form-login-handler
AuthFormLoginRequiredLocation "http://example.com/login.html"
AuthFormLoginSuccessLocation "http://example.com/admin/index.html"
AuthFormProvider file
AuthUserFile "conf/passwd"
AuthType form
AuthName /admin
Session On
SessionCookieName session path=/

还有我的 html 表单:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
  <form method="POST" action="/">
    <input type="text" name="httpd_username" value="" />
    <input type="password" name="httpd_password" value="" />
    <input type="submit" name="login" value="Login" />
  </form>
</body>
</html>

标签: htmlapache.htaccesserror-handlinglocalhost

解决方案


推荐阅读