Skip navigation

We wanted to create and run some custom error pages for 404 and 403 server errors for our site.  The standard way to do this, it seems would be to create a .htaccess page for the site and configure httpd.conf to allow for it. 

However, after some digging around, I found that since I’m running more than one site on our server (virtual hosts), the configuration can be done via the sites virtual host configuration file.  Opening up this file in a text editor (I like vi for this purpose) allows you to manipulate this as well as some other configurations for the site.

Terminal commands would thus be:

cd /etc/httpd/sites

sudo vi

If you already have a custom 404 page (which can be changed in the “Sites” tab of the Web Service under Server Admin), you should see the configuration:

ErrorDocument 404 /WhateverYourPageNameIs.htm

Now, all you have to do is add another entry below this one formatted just like that for any other error code, in our case a 403 Forbidden error:

ErrorDocument 403 /WhateverYourForbiddenPageIs.htm

If you don’t already have a custom 404 document, you can add these entries just before the start of the module listings. 

If you’re running SSL on a site, you’d need to modify the config file for the SSL version of the site. 


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 )

Google+ photo

You are commenting using your Google+ 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

%d bloggers like this: