5

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?

Tom
  • 950
  • 3
  • 15
  • 27
  • Try without leading slash (as URL is relative to the `DocumentRoot`). If that will not help -- you can achieve the same effect by using **mod_rewrite rule** (that's if that module is available on that server, which may not be the case on some cheap hosting plans). – LazyOne Apr 10 '12 at 11:04

1 Answers1

0

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!

d-_-b
  • 21,536
  • 40
  • 150
  • 256