404 Page Implementation

Hi there,

For a while now I’ve had the standard browser 404 page and I’d like to design and implement something different. However, does anyone have any ideas how I could go about doing this? I’ve had a search around online but so far haven’t found anything very definitive. I guess a lot of it depends on my current server setup??

Cheers,

Shoxt3r

Hi Shox3r,

Do you use Apache or IIS for your Web Server? If using Apache you do something like this

It is generally a good idea to give the user an option to get back to a ‘good’ page like index.html or home.html; you can provide a link or you can redirect them to a good page after a reasonable time has past for them to read your error page info.

Steve

Shox,

I’ve not seen SS’s link but have something in my signature’s mod_rewrite tutorial.

Two additional points:

  1. There was a recent thread in which Ralph and I went back and forth about techniques on 404 redirections. We said the same thing but I added a meta (timed) redirection statement to a page which notified the visitor for the reason for a redirection then redirecting to a 404 handler script (or, simply, a sitemap) which the visitor can use to link directly to the requested page (using a correct link).

  2. mod_speling can correct capitalization errors as well as minor typos when a visitor relies on entering your link by hand.

Regards,

DK

Thanks for your replies. I believe that my Web Server is running on Apache (I pay for hosting from Streamline.net).
I remember asking the support team at Streamline about accessing the htaccess file and below was their response.

Thank you for your query

We just want to inform you that we only support mod rewrite on htaccess.

So I guess that points to what you are saying DK?

Shox,

Upload a file with one line: <?php phpinfo(); ?> then save that page (so you can refer to it later) and DELETE that file from the server (you don’t need to help hackers by providing all that information). The phpinfo() output will contain information about your server, active modules, etc., i.e., a wealth of information.

No, I interpret their response to say that they will not enable mod_speling on your server (shame on them!).

The nature of the .htaccess file is that it can contain all sorts of Apache directives so “only support mod_rewrite on .htaccess” is bogus.

Regardless of their position on mod_speling, I believe that you can use mod_rewrite to redirect 404s (i.e., !-d and !-f … if you don’t understand that notation, look at the link in my signature) to a “Whoops Page” telling visitors their requested link is unavailable and that you’re redirecting to … (a) your sitemap script or (b) a script which can read the original {REQUEST_URI} (even if it had to be appended to the redirection(s) as a query string) to try to guess the visitor’s intent or (c) your Home Page (which should have valid links to your website).

Regards,

DK

Great! Thanks for your reply, will look into all of this and report back :slight_smile: