views:

201

answers:

2

I'm customizing the 404 page for my website. I'd like it to include a "Did you mean...?" I need to figure out how to do this.

Here's what I'm doing so far: I come up with a broad list of files that the user might be looking for, then use levenshtein() to compare each possible filename to the mistyped filename. Those with the lowest differences are selected for "Did you mean."

I've also considered using metaphone(), but I think it may be excessive.

What would you suggest for a "Did you mean...?" script?

+3  A: 

One thing you might want to consider is Google's 404 script for doing just what you mentioned. It probably wouldn't be as good as a custom solution, but it may be worth trying out to be sure.

http://googlewebmastercentral.blogspot.com/2008/08/make-your-404-pages-more-useful.html

Micky McQuade
A: 

It sounds like you want more, but have you looked at Apache's mod_speling

ysth