【问题标题】:.htaccess error document using html fragment - not working, but why?.htaccess 使用 html 片段的错误文档 - 不工作,但为什么?
【发布时间】:2013-05-14 23:56:24
【问题描述】:

谁能帮我解决这个问题?

我正在尝试将错误代码定向到 error.html#401 等。

例如,当您转到http://www.interimspaces.co.uk并单击电子邮件邀请下的链接时,如果您取消两次,您将获得基本页面但没有文字,

什么时候你应该得到http://interimspaces.co.uk/error.html#401

我尝试将 .htaccess 文件放在顶级目录中,然后放在 interimspaces.co.uk/pitch 中,但我遇到了同样的问题。

代码如下:

ErrorDocument 401 /error.html#401
ErrorDocument 404 /error.html#404
ErrorDocument 500 /error.html#500

任何帮助表示赞赏。

谢谢。

【问题讨论】:

    标签: html apache .htaccess fragment error-code


    【解决方案1】:

    # 是 apache 文件中注释的开头,因此您需要将其括在引号中:

    ErrorDocument 401 "/error.html#401"
    

    【讨论】:

    • argh - 不幸的是,看起来并没有完成这项工作
    • @annoyingnewbie 尝试使用完整的 URL,例如 ErrorDocument 401 "http://example.com/error.html#401"
    • 仍然不高兴 - 尝试了完整的表达方式。无法想象我做错了什么
    • 使用这种格式 ErrorDocument 404 /error.html#404 它显示了 html 但减去了 html 片段......这真的很奇怪。 apache 可能在解析片段时遇到问题,但必须有办法克服这个问题......?
    • @annoyingnewbie 不应该是ErrorDocument 404 "http://interimspaces.co.uk/error.html#404"吗?
    猜你喜欢
    • 2012-06-22
    • 2013-08-20
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多