![]() |
Custom 404 error pageAlmost everybody has been confronted by a HTTP 404 File not found page before, you click through to a site expecting to see the page that interests you but instead get the - "This page does not exist" response. The problem from a site owners point of view is that although you're site may exist, people will tend to look at this and think 'better press the back button, this site either doesn't exist anymore or is more trouble than it's worth'. If you're not familiar with the generic HTTP 404 File not found page look here Now loosing visitors to your site is obviously not a good thing. Even if the page they were looking does not exist anymore, you would still like them to visit you're site, after all you may have just renamed that page. Fortunately there's a solution, and that's to create you're own custom response page to any 404 errors on your server The first thing to do is to make the html page that people will see when a 404 error occurs on your server. This should indicate the name of your business/web site along with a brief description of what could have gone wrong i.e. page doesn't exist, page not found or temporarily unavailable. For an example of how I used a custom 404 page on this site have a look here, the redirection to the home page has been disabled to allow you to study the page You can include what ever links you see fit on the page, links to your home page and site map are a good idea. You can also automate the redirection process by using a meta-refresh. This is done by inserting the meta-refresh tag inside the html of your custom 404 page, just below the title tag
If you want to use a meta redirect on your 404 page just copy and paste the code above into your html, put the name of your site in with the file to link to, in this case your index or 'home' page. To adjust the delay before being redirected change the value of CONTENT, this is set to 7, i.e. 7 seconds WARNING Using the meta-refresh can cause problems with most major search engines. If you use a meta-refresh in your custom 404 page, especially with a fast refresh rate then you risk getting banned from the search engines. The way round this is to use a robot.txt file in the root of your domain that disallows search engine robots looking at the file, you should do this anyway as you don't really want your custom 404 page indexed and then served up to searchers. Once a suitable page has been designed give it a name e.g. notfound.htm and upload it to your server, create a directory called errors and place it in here e.g. www.neurocyber.co.uk/errors/notfound.htm Once this has been done you need to create a .htaccess file that goes in the root of your domain, this tells your server where to go when any erroneous page access requests are made. To do this use a text editor such as 'Notepad'. Insert the line - ErrorDocument 404 /errors/notfound.htm (as in the image below)
When you save this file, make sure you save it as .htaccess and not .htaccess.txt, it will not work otherwise. Tip: If you're using Windoews Notepad to make your .htaccess file to stop Notepad appending .txt to the end of the file enclose the file name .htaccess with quotation marks i.e. ".htaccess" and it will save the file correctly Now upload it to the root of your domain e.g. www.neurocyber.co.uk/.htaccess If everything has gone correctly you should now have your own custom response to any 404 errors and hopefully be able to scoop up all those previously lost visitors!
home | getting started | keywords | page titles | meta tags All Rights Reserved ® neurocyber privacy policy | terms and conditions |
|
||||||||||||||||
|