[pmwiki-users] Mediawiki to PmWiki migration - how to preserve old links

Patrick R. Michaud pmichaud at pobox.com
Fri Jan 12 18:01:52 CST 2007


On Fri, Jan 12, 2007 at 10:39:06PM -0000, Crisp, Steve [UK] wrote:
>    All,
>     
>    You (Patrick) came up with the goods with my last problem (ref. redirect
>    to URL), here's another....
>     
>    I'm migrating this OpenSource site from MediWiki to a proper Wiki - PmWiki
>    of course!  I need to preserve links to around 50 articles (read:
>    URLs) and have them redirected to the relevant (new) PmWiki articles. 
>    Example below:
>     
>    Existing MediaWiki URL:
>    http://wiki.enginuity.org/index.php?title=Frequently_Asked_Questions
>     
>    New PmWiki URL (temporary site!):
>    http://scoobypedia.co.uk/enginuity/index.php/Enginuity/FrequentlyAskedQuestions
>     
>    I want to retire the 'old' wiki so running it parallel is a last resort.
>     
>    Has this problem already been solved before?  Do you recommend it's solved
>    in PmWiki or in some kind of web server configuration?

I'd do it with a special-purpose php script.

As a start, you could replace your existing (MediaWiki) index.php
script with something like the following:

    <?php
      $title = @$_REQUEST['title'];
      header("Location: http://scoobypedia.co.uk/enginuity/index.php/Enginuity/$title");

This would cause all requests to the old MediaWiki pages to
result in a redirect to the new PmWiki location.

Then we just need to figure out if there are any name-remappings
required, since MediaWiki uses underscores between words while
PmWiki uses CamelCase.  A simple "remove all the underscores"
approach would be:

    <?php
      $title = @$_REQUEST['title'];
      $title = str_replace('_', '', $title);
      header("Location: http://scoobypedia.co.uk/enginuity/index.php/Enginuity/$title");

Other modifications can be added with little difficulty (I'll be glad
to help with this).

Pm




More information about the pmwiki-users mailing list