lucy24 - 6:59 pm on Apr 10, 2013 (gmt 0)
the question is in which file should I add this code?
In the config file. Counter-question: What were the other possibilities?
If it's your own server, you won't need htaccess files, so you can leave AllowOverride at None. Anything directory-specific goes in <Directory> sections within the config file.
Minor exception: Depending on your site, you may want to permit Options. This includes some features like auto-indexing and SSIs that are easiest to keep track of if you enable them in the appropriate directory rather than fiddling with the config file-- especially if you need to change things on the fly.
Apache says-- I assume you've seen this already--
For security and performance reasons, do not set AllowOverride to anything other than None in your <Directory /> block. Instead, find (or create) the <Directory> block that refers to the directory where you're actually planning to place a .htaccess file.
Unfortunately ErrorDocument is part of the huge "FileInfo" category, even though it's another thing you'd often want to change on a directory-by-directory basis.
If you're just setting up the server, you might start out being fairly generous with your AllowOverrides, so you don't need to restart the server every time you realize you need one directory to behave differently. Once everything is stabilized, shut off the AllowOverrides and shift the htaccess rules to <Directory> sections within the config file. Anything that can go in htaccess can also go in <Directory>. (The opposite is not always true.)