Solved

server wide ErrorDocument with virtual hosts

Posted on 2004-10-02
4
416 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VM backups can be lost due to a number of reasons: accidental backup deletion, backup file corruption, disk failure, lost or stolen hardware, malicious attack, or due to some other undesired and unpredicted event. Thus, having more than one copy of …
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

932 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

11 Experts available now in Live!

Get 1:1 Help Now