Redirect All Requests to a Single Page

I found this little tidbit useful. I guess it’s not that hard to figure out yourself, but it might make a nice FAQ. Basically, in the midst of moving some of my server stuff over to Slicehost, I knew my web server wouldn’t be able to respond for a few minutes, so I wanted to put a reasonable looking “Sorry, we’ll be back soon” message, rather than just letting it fail. On a Debian or Ubuntu system, this ought to be enough:

In the /etc/apache2/apache2.conf file, the last line looks like so:

Include /etc/apache2/sites-enabled/

Comment it out, and put this in instead:

#Include /etc/apache2/sites-enabled/
AliasMatch .* /var/www/backsoon.html

All it takes is an /etc/init.d/apache2 reload to make the change take effect, and another one once you’re up and running again.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s