1

Here's what I'm trying to accomplish. Right now, in /var/www I have an .htaccess file with multiple ErrorDocuments defined for various errors.

I also have subsites (i.e. /var/www/tf2c, /var/www/obtf2). Right now, I've got any missing pages in those directories set to link to a template page to inform anyone viewing those sections that the site has moved to a new host. However, there are many links that I'd need to create Links for so I'd rather just use a separate ErrorDocument for the /var/www/tf2c folder to handle things so I can ditch the template page altogether.

What I tried doing was putting an .htaccess file inside /var/www/tf2c and defining "ErrorDocument 404 ", but then the original .htaccess file in /var/www stops working altogether.

How do I make this work so that /var/www's ErrorDocuments take precedence unless someone is browsing a site in /var/www/tf2c or /var/www/obtf2, in which case, those sites .htaccess takes precedence and displays its own custom 404 page?

1

IMHO You're already heading the wrong direction with your intention to create a .htaccess files, which is my pet peeve, quoted from from the manual on .htaccess files:

You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block in the main Apache configuration file(s), as it will have the same effect with better performance.

Your question seems to indicate that you have multiple subsites and implies that you have a VirtualHost section for each of those. Simply declare the custom ErrorDocuments in each VirtualHost section. Then they won't interfere.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy