AnOwnSite header

Use htaccess error pages to friendly inform your lost visitors.


Easy htaccess error pages

You can use htaccess error pages to friendly inform visitors that were lost on your website. They replace the typical "404 Page Not Found", so instead of leaving them alone, you can funnel your visitors back to your website.

And this is really very easy. All you have to do is add a line to your htaccess file like this one:
ErrorDocument code /directory/error-page.html
Now you create the error-page.html and put it in the directory you specified in the htaccess file. If it resides in the root of your website, no directory specification is necessary.

There are a few server errors that can occur if a browser asks for a page. They are identified by a code and the most common ones are: There are more error codes, but these are the most common ones.

You can write a seperate page for each error code. Just add the code to your htaccess file like this:
ErrorDocument 400 400badrequest.html
ErrorDocument 401 401authentication.html
ErrorDocument 403 403forbidden.html
ErrorDocument 404 404notfound.html
Of course you can name the pages to your likings. These are just examples of htaccess error pages.

And that's it. htaccess error pages are a very easy way to inform lost visitors about the status of their request and guide them further through your site.


Click to return to htaccess possibilities