Use 404 ErrorDocument that is in a sub directory

拈花ヽ惹草 提交于 2019-12-23 15:02:02

问题


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?


回答1:


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!



来源:https://stackoverflow.com/questions/10087323/use-404-errordocument-that-is-in-a-sub-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!