the_oliver Posted May 12, 2007 Share Posted May 12, 2007 Im trying to have individual error pages for each of my vhosts. The part thats proving difficault is having the error pages outside the Document root. Eg DocumentRoot /var/www/domain.com/httpdocs and errors in /var/www/domain.com/error. The vhost code im using is: <VirtualHost *:80> ServerAdmin webmaster@domain.com DocumentRoot /var/www/domain.com/httpdocs ServerName www.domain.com CustomLog logs/domain_log combined <IfDefine ERRORDOCS> Alias /error/ "/var/www/doman.net/error/" <Directory "/var/www/html/domain.com/error/"> AllowOverride None Options IncludesNoExec AddOutputFilter Includes html AddHandler type-map var Order allow,deny Allow from all </Directory> </IfDefine ERRORDOCS> ErrorDocument 404 /404.html However when i tried to restart the service if get the following error: Starting httpd: Syntax error on line 1112 of /etc/httpd/conf/httpd.conf: Expected </IfDefine> but saw </IfDefin> Line 1112 is the one above starting "<IfDefine ERRORDOCS>". Can anyone offer me some advice? - Thanks! Quote Link to comment Share on other sites More sharing options...
steviewdr Posted May 13, 2007 Share Posted May 13, 2007 I dont think you need any of the <IfDefine ERRORDOCS>. All you need is: ErrorDocument 404 /var/www/html/domain.com/error/error.html -steve Quote Link to comment Share on other sites More sharing options...
the_oliver Posted May 13, 2007 Author Share Posted May 13, 2007 I thought of that, but apparently it reads from the DocumentRoot, rather then the /var. So it told me it couldnt fint the error page! I also tried ../error but then when it needed an error page it just printed ../error to the browser! So it would try to reed form /var/www/doman.com/httpdocs/var/www/...ect.. Thanks! Quote Link to comment Share on other sites More sharing options...
steviewdr Posted May 14, 2007 Share Posted May 14, 2007 Well how about: ErrorDocument 404 http://vhost1/domain.com/error.html ErrorDocument 404 http://vhost2/domain.com/error.html -steve Quote Link to comment Share on other sites More sharing options...
the_oliver Posted May 14, 2007 Author Share Posted May 14, 2007 Not sure i understand that? Would that not put the error docs in the same folder as the main site? Im keen to keep them in a directory bellow! Thanks for you help so far! Quote Link to comment Share on other sites More sharing options...
steviewdr Posted May 15, 2007 Share Posted May 15, 2007 Ah - ok. I read your initial post too quickly...again. Right - so you want your ErrorDocument outside of your DocumentRoot. Well this should work on its own so. Add these lines into the vhost: Alias /error/ "/var/www/doman.net/error/" ErrorDocument 404 /error/404.html I have tested, and that works fine for me. Make sure that the file "/var/www/doman.net/error/404.html" has read permissions to be read by the webserver, i.e. chmod 644. -steve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.