With the diff attached and a file like this placed in the search404 directory you can list as many redirects as you want to in one long array. I've given an eample of what the search404.php would look like but haven't attached it.

<?php

// Uncomment the line below if your array is in the form 'destination' => 'source'
// $array_order = 'd2s';

$migration = array('/about/advisorycouncil.phtml' => '/about/board');

Useful to help migrate folks to drupal from something else.

Mike

CommentFileSizeAuthor
migration_search404.module.patch1006 bytesmgifford

Comments

robertdouglass’s picture

Maybe I'm just not intimately familiar enough with the search404 module, but I have a hard time understanding what your code here does. Could you explain it again, for me?

mgifford’s picture

Hi Rob.. It was in two pieces.. The patch to the existing code and a summary of the new 'config' page search404.php.

If a site is being migrated they may well know that they want the old url to always go to a new one. So let's say there's a migration from some other cms:
http://www.example.com/about/advisorycouncil.phtml

And you want this always go to to the new Drupal url:
http://www.example.com/about/board

You'd apply the patch, and create a file a search404.php file in the same directory with:

$migration = array('/about/advisorycouncil.phtml' => 'about/board');

And your users get redirect.. I got presented with a spreadsheet of old urls vs new urls and needed to find some way to automate the redirection for the site's users. There were about 300 or so urls in the list.

Ideally this would get extended so that it would be an sql call, but in the interim I hope this helps fuel some discussion about how to aid migration to drupal.

Mike

larssg’s picture

If what you want is to show about/board when the user goes to about/advisorycouncil.phtml, you should be able to simply use url aliases. This does require a bit of extra work, of course, as you need to enter the "real" url for about/board (node/xx). However, if what you want is a module to actually make the browser reload the page by sending a "301 Moved Permanently", I think this is beyond what search404 does or should do.

Please tell me which feature you are looking for as I would like to help you make such a module if nothing already exists.

mgifford’s picture

This has been discussed a number of times, but there doesn't seem to be any comprehensive response to dealing with 404's. The best solution I've seen is to send a user to a search form. While this is better than showing them an error page it's not ideal either.

I'm now in the process of migrating a largish static site to Drupal.
Reposting notes posted to the dev mailing list

What I would like to see ideally:

1) A page listing like admin/logs' Page Not Found reference but tracking
- The most frequently incorrectly accessed page (in the log's history)
- The biggest source of incorrect links (separated by internal & external links)
- It should also be divided into those links that have specified redirects and those links which do not yet have a specified redirect defined (see below)
2) A link from the summary list above (next to details) to a redirect link that would allow you to indicate where that page should go.
- This should list the redirect and allow you to edit it (if it is defined), or indicate that you can define the redirect.
- It should also allow the admin to define either the full or partial URL as part of the redirect (sometimes multiple domains may be directed).
- Would be great to see a list of all referrers (in the log's history) as an option here too to make it easier to update the links
3) After a redirect link is defined it should be transparent to the visiter. The use of the redirect should still be logged (as it is better to know that links should be updated on an external site). However, if a redirect hasn't been defined the user should be:
- presented with a search page that is populated by strings parsed from the incorrect URL.
- the choice that the users make should be logged and it would be really cool if there was an auto mode to set up a redirect link (if say 10 people all choose the same link).

----

kb@2bits.com replied with:

This is a very good scheme.

I wrote customerror to give the user an admin defined message for 404
and 403, as well as redirecting the user from a 403 to the the page
they were trying to access after a 403.

There has been requests to add PHP to customerror, presumably for
admins to add custom code that will do what you just described, or
parts of it.

As for your scheme, parts of it used to exist with a old redirect
(part of legacy?), that was dropped in favor of Apache level rewrites
(since they are faster). For a large site your scheme can be a
performance drag. We also have to be careful that this module does not
conflict with path aliases by being cyclic (e.g. put a redirect limit
of 3 or 5).

I think this is work turning into a module.

--

December got busy so I didn't follow up further than that. But this is the bigger picture.

Mike

larssg’s picture

Status: Needs review » Closed (won't fix)

I really think this calls for a new module. I agree that those features would be very nice to have, but I don't think it should be part of search404.