Forum Moderators: open

Message Too Old, No Replies

Different 404s for different folders within same site

         

Purple Martin

12:39 am on Aug 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi everyone,

I think I saw something about this a couple of months ago but I can't find it anywhere.

I want to use one custom 404 for one folder (and it's subfolders) in a site, and use a different custom 404 for another folder (and it's subfolders) in the same site. Is this possible? I'm guessing that there's something I put in htaccess, I just don't know what.

Thanks in advance!

jdMorgan

3:56 am on Aug 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Purple_Martin,

I believe you can do this by putting a .htaccess file in each of the top directories for each
of the two separate "branches" you want to define. Then define the ErrorDocument you want to use
only for that directory and the directories below it. This is sometimes called a "per-directory
.htaccess".

Remember that in order to return a proper 404 code to the user's browser, the path given for the
ErrorDocument should be a relative path, i.e. it should NOT contain a method and domain, such as
"http://www.yourdomain.com", only the "file path" on your server, such as "/my_404_page.html".

ErrorDocument is documented in the Apache Core Features documentation.

HTH,
Jim

Purple Martin

4:22 am on Aug 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for that jdMorgan. So it looks as though it's as simple as putting a seperate .htaccess file in each folder :) .

For anyone else intereted in the documentation jdMorgan mentions, I found it here [httpd.apache.org].