Welcome to WebmasterWorld Guest from 54.159.19.75

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

ErrorDocument help

     
9:49 pm on Mar 5, 2013 (gmt 0)

Junior Member

joined:Oct 17, 2012
posts:52
votes: 0


Where do I place this code?
ErrorDocument 404 /404.php

Do I place it before my index and non-canonical redirects or after?
It must come before any rewrites, am I correct?

Any help would be appreciated. Thanks in advance!
11:05 pm on Mar 5, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


Put it near the top of your htaccess along with any other one-offs: Options, Include lines and so on.

Technically the ErrorDocument is a kind of rewrite. But it isn't done with mod_rewrite, so location doesn't matter. Each module is an island; they execute in a fixed order, no matter where you've put them in htaccess.
1:44 am on Mar 7, 2013 (gmt 0)

Junior Member

joined:Oct 17, 2012
posts:52
votes: 0


Okay that works great! I love learning this stuff.

Thanks lucy24!
9:00 am on Mar 7, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


The htaccess file is processed by each Apache module in turn, not in the order the directives appear on the page. The order that the modules are activated is defined elsewhere within Apache.

However, for the various directives processed by the same module, the order IS important, because each module DOES process it's own directives in the order shown in the htaccess file.

Put all the mod_auth stuff together, all the mod_rewrite stuff together, etc.
9:22 am on Mar 7, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 19, 2002
posts:3171
votes: 8


thanks for clearing that up g1smd

... as i put the ErrorDocument codes last!
9:45 am on Mar 7, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


I tend to put them first, rather than bury them after a lot of mod_rewrite code. It doesn't really matter all that much.
11:10 pm on Mar 7, 2013 (gmt 0)

Junior Member

joined:Oct 17, 2012
posts:52
votes: 0


Hey thanks g1smd for that extra information, as I was certainly not aware of that.