Wednesday, June 20

"Intelligent" Custom 404 Page

This is fairly simple, but took me quite a while to find. I wanted to use a custom 404 page on my WIMP, but I wanted to be able to do SSI, php and whatever. Well setting the 404 page is easy enough.

  1. Open IIS Manager

  2. Right-click on the website and go to properties

  3. go to the tab Custom Errors

  4. scroll down to 404 and click edit
Now this is the part I couldn't find any info on. If you pick File from Message type: you can only use htm/html files. If you pick an shtml file, the page will display, but no includes will work. If you pick a php (or asp) file, when you try to access a nonexistent page, the browser will download the 404 page!

To be able to use shtml/php, you have to pick URL and give it a link from site root (e.g. /404.php). Hit OK and Apply and it's all set.

Now you can set your 404 pages to anything you want. One helpful thing is to have it take whatever they typed in and use it as a search term for the site.

No comments: