Let me preface this post with a little story.
This past February, we went live with a new website. Our old website had been active for many years, but it needed an overhaul. When we had the new site ready to go, I turned the old site off, and our new site on. That was back in February. One of the functions of the new website, was IIS’s ODBC logging to an Access 97 .mdb. For the past month or so, I have been slowly but surely adding ASP pages to an Administrative site, to show information about who is hitting our site, when they are hitting it, and what they are seeing. Yesterday, I finally made a page that showed the actual hits to each page on our site. When I ran that page, it showed in the number 6 slot, a link that doesn’t exist on our site: /faq.htm. Our current FAQ site is further into the site then just the root folder. This was kind of surprising. In fact, we had over 6000 requests (since February) for that page. When I tried the page, I got the Error 404 Page not found web page.
Not good. I looked at our old site, and sure enough, in the root was a page called faq.htm. My initial instinct was to put a faq.htm page on our new site, that had a link to the new FAQ page. But then it dawned on me. How many other pages had ‘ghost’ links on the internet, which would cause potential visitors to give up, when a link is bad?
So, yesterday I built an Access 97 database, VB 6.0 .dll, and ASP page, which are all attached to this post. I then went into my IIS server settings, and changed the 404 page to my new ASP page.
The results? Now, when a user hits our site, if the page they are requesting cannot be found, the ASP checks the URL in the database. If it finds a match in the suggested routes, it sends the user a page that gives the explanation from the database, with a link to the new page. That page refreshes after 10 seconds, to the referred page. If there is no match, it uses the ‘default’ message and link (our home page), which is also in the database (so it can be changed without recompiling the .dll). It also logs the hit (URL, Referrer, IP Address and TimeStamp). That means no matter what page you are trying to find on our site, if it doesn’t exist, you get a page that loads our homepage for you!
No more ‘Page not found’ errors!
Hope someone else finds this useful!