Solved

server wide ErrorDocument with virtual hosts

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Are you looking to recover an email message or a contact you just deleted mistakenly? Or you are searching for a contact that you erased from your MS Outlook ‘Contacts’ folder and now realized that it was important.
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

737 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