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

StackOverflow https://stackoverflow.com/questions/9250627

문제

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 paths 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top