【问题标题】:Images path has been change when htacess command custom error page当 htacess 命令自定义错误页面时,图像路径已更改
【发布时间】:2014-01-17 18:50:22
【问题描述】:

我已完成创建自定义错误页面(403.html 和 404.html)。然后我把它上传到主机。我会查看页面,所有的 css 和图像都有显示,它完全可以工作。

然后我用这些代码编写 htaccess 自定义错误页面。

ErrorDocument 403 /errordocs/403.htm
ErrorDocument 404 /errordocs/404.htm

然后我已将其上传到服务器。我对其进行了测试。

当我访问页面得到错误 403 (ex.www.domain.com/images/) 它会显示 403.htm 页面,但图片没有显示,我检查了图片 url,这是我在 403.html 上创建的错误 url

  • 我创建的403.html上图片的url是

    www.domain.com/images/images/403-text.png

  • .haccess 命令错误页面的 403.html 上的图像 url 是 http://www.kbyala.ac.th/images/images/403-text.png

我不知道怎么了。如何解决这个问题。请帮帮我:'(

【问题讨论】:

    标签: image .htaccess custom-error-pages


    【解决方案1】:

    在您的 403.html 页面中,将 url 指定为

    <img src="/images/images/403-text.png" />
    

    其中 / 表示您网站的根文件夹,因此 /images/images/403-text.png 是相对于您网站的根文件夹的。

    不要在 src attr 中包含 www.domain.com。

    【讨论】:

    • 前面的反斜杠为我做了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    • 1970-01-01
    • 2011-06-05
    • 2019-11-07
    • 1970-01-01
    • 1970-01-01
    • 2015-05-08
    相关资源
    最近更新 更多