Apache Server Catchall

One more trick to keep traffic from getting away. When setting up the Virtual Hosts section on an Apache web server add the following VirtualHost at the end of the list:

#
# MUST REMAIN LAST IN LIST!!!!
#
<VirtualHost *:80>
ServerName catchall
ServerAlias *
DocumentRoot /home/charris/public_html
</VirtualHost>

When traffic is sent to your web servers IP address the server will go down the Virtual Hosts list and send it to the first web directory match it finds. Occasionally traffic will hit your server that for one reason or another the sever isn’t set up to deal with. Give it a place to go with this catchall host.

Set the DocumentRoot to your favorite website.

IMPORTANT: This must go last in the list as it will catch everything that gets to it. Any Virtual Hosts set up below it will never work.

This entry was posted in Servers and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


(required)*