Posts Tagged ‘Apache 2’

Adding a Custom Error Page when Hosting Multiple Sites Using Apache

Another optional extra you might want to consider when hosting multiple sites, or just when working with subdomains, is a custom error page.

Using the more basic configurations detailed in previous tutorials, you may occasionally find odd results being returned to your clients. For example, if someone were to simply type your server’s IP into their browser, or spelled a subdomain incorrectly, Apache2 will serve them up the first site it finds in its configuration path. If you’re hosting multiple sites, this means that a totally different site might be returned, which doesn’t exactly look professional.

Here, I’ll show you how to easily counter this problem, by creating a custom error page for your server.

[If you’re not familiar with Apache configuration files, read one of the tutorials linked above for more info.]

Step One

Create your custom error page and save it as ‘index.html’. In this example, we’re going to create the ‘index.html’ file at /home/randymarsh/errorpage/index.html.

This page could just be an image or some text, or you can write a redirect to one of your hosted sites or their subdomains. As long as it’s called ‘index.html’, you can do what you want here.


Creating Subdomains With Apache 2

In my last post we covered how to host multiple websites from the same server. This is really useful if you have several domains or are hosting websites for others and don’t want to invest in multiple lines and more hardware, but what if you just wanted to create a subdomain for a site you already own?

For example, if your main site was located at ‘’ and you wanted to add a blog, but didn’t want to move away from your domain to access it, you can add a subdomain – ‘’, for example – at which it can be read.

This is an extension of the longer post about multiple site hosting, so if any parts are not explained, please read the previous entry linked above for a better understanding.

It’s a pretty simple process which can make a single-domain site much more flexible.