Pregunta

I have a htaccess file in a sub folder like so:

/subfolder/.htaccess

In the htaccess file the following code to set a 404 ErrorDocument

ErrorDocument 404 /404.php

The issue is the 404 page in the root directory is loaded rather than the one in the /subfolder/ folder. I can't simply change the htaccess file to use /subfolder/404.php because the system is going to be installed in lots of different places.

Is there a way to reference the files in the directory that the htaccess is in?

¿Fue útil?

Solución

I just had the same problem and found you page...If you have domain/folder and want to redirect anything from the folder back to the domain's index, use ErrorDocument 404 /

...I'm not sure if this goes to the root folder or one folder up, but in your case (and mine) they are one in the same.

Hope this helps!

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