Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Error Pages For Virtualhosts.

Status
Not open for further replies.

Wullie

Programmer
Mar 17, 2001
3,674
GB
Hi,

What I am trying to do is apply custom error pages to all the virtualhosts I have.

If possible I want to redirect the user to an error page on the individual users directory.

So if a 404 error is called for virtualhost1 the error page in that directory is called and the same for virtualhost2 etc.

I thought that you could simply add the error line into the virtualhost directive but that does not seem to work.

Is there any way to do this?

Thanks in advance, Wullie

 
Hi,

You are able to include ErrorDocument directives within a <VirtualHost > container :

<VirtualHost 10.1.2.3>
ServerAdmin webmaster@host.foo.com
DocumentRoot /ServerName host.foo.com
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 /subscription_info.html
ErrorDocument 403 &quot;Sorry can't allow you access today
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>

Obviously, the paths are relative to the DocumentRoot path.

Regards
 
Thanks mate,

I thought you would be able to do that but it wouldn`t work for me!!

I think I may have to reinstall apache as there are a lot of strange things happening with my setup.

Thanks again, much appreciated

Wullie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top