Solved

server wide ErrorDocument with virtual hosts

Posted on 2004-10-02
4
431 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

707 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