Solved

server wide ErrorDocument with virtual hosts

Posted on 2004-10-02
4
414 Views
Last Modified: 2013-11-18
hey there,

In my apache config file I have this as the default directory:

<Directory "d:/www">
    Options FollowSymLinks +ExecCGI
    AllowOverride None
  AddHandler cgi-script .pl
  ScriptInterpreterSource registry
    Order deny,allow
    Allow from all

  ErrorDocument 404 /custom/cust_404b.html

</Directory>        


then I have a couple of virtual hosts defined like this:

<VirtualHost 123.123.123.123:80>
  ServerName demo.example.com
  DocumentRoot d:/www/demo
</VirtualHost>  

The problem is that the way I have it set up, I have to have a separate "/custom/cust_404b.html" directory and file in every virtual host directory since the URL path to the error document is relative.   How can I have a server wide custom error document such that a 404 for any domain/page combination hosted by my server returns the same error document?  

thanks!

-andrew


0
Comment
Question by:mcdunna77
4 Comments
 
LVL 15

Accepted Solution

by:
periwinkle earned 63 total points
ID: 12208891
There's a couple of solutions that come to mind.

You can have a rule like:

ErrorDocument 404 http://www.yourdomain.com/custom/cust_404b.html

however, that has the disadvantage of shifting domains to yourdomain.com, instead of staying with the domain of your virtualhosts (like demo.example.com).

You could add an alias, like:

Alias /custom/cust_404b.html d:/www/custom/cust_404b.html

... that would probably do the trick!  I'm not certain if you could just put that in the 'default' config, or if you'd have to put that in each of the subsequent virtual hosts.
0
 
LVL 4

Assisted Solution

by:TomDavidson
TomDavidson earned 62 total points
ID: 12228120
I've found that this works best with an alias for each virtualhost for many shared resources including all the ErrorDocs.

I'm sure I had the alias declared in the global section of the configuration.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now