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

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

Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top