[development] 404 search

Andre Molnar mcsparkerton at yahoo.co.uk
Wed Nov 30 02:37:23 UTC 2005


A simple solution:

Createa a full PHP page:
Include your standard 404 not found text ('sorry you didn't find what 
you were looking for')

Parse the request URI and create a query string
Use that to generate a link (to the search page)

No automatic search result - but it gives the user the option to use the 
search with a pre filled query in the form of a link.

<a href="search?keys=<?php print $query_string;?>">[whatever they 
searched for]</a>

(or whatever the proper code would be these days)

make that page your 404 page

andre

Khalid B wrote:
> Here is another variant by someone else (also based on Steven's).
> http://www.settingtheworldtorights.com/files/drupal/ii404-4.6.tar.gz
> 
> On a small site this may be acceptable. However for a large site I would
> think twice, since reorganizing content can cause a lot of 404s. There
> are even cases where 404s from missing images, or confused crawlers,
> relative pathnames, RSS readers, ... etc such as this issue:
> http://drupal.org/node/13148
> 
> So, a search will be performed for all 404s, whether human generation
> or not.
> 
> On 11/29/05, David K Norman <deekayen at deekayen.net> wrote:
> 
>>I just wanted to make sure this wasn't implemented before I submitted an
>>official feature request issue.
>>
>>Sometimes I remove an attachment from a node, but Google still keeps it
>>indexed for a while. I can see people still trying to access the file in
>>my logs, but they get a 404. I think it would be cool if the 404 message
>>was able to say "Page not found", but then use the missing URL as a
>>search string to display other possible similar pages in the site under
>>the Page not found message.
>>
>>David Norman
>>http://deekayen.net/
>>
> 
> 



More information about the development mailing list