开发者

Is it possible to use apaches ErrorDocument 404 to actually change the URL instead of needing absolute paths?

We have in a htaccess file:

ErrorDocument 404 /404.shtml

Which works to show the 404.shtml file. The problem is when someone types thedomain.com/folder1/folder2, it breaks the layout as the page is using relative paths rather than absolute. I know I could use absolute pat开发者_Python百科hs to fix this issue, but I am wondering if there is a way where it can actually change the path to the 404.shtml, so the relative paths can remain.

Thanks in advance.


After lots of research, it is best to stay with absolute paths. This can be acheived through rewrites and coding the header to return 404, but it's not worth it when it can simply be done with absolute paths.


You can point ErrorDocument to an URL. Apache will generate a redirect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜