Help me redirect my old URLs
February 13, 2008 3:50 PM   Subscribe

Help me redirect my old URLs.

So we switched sites. The old URL structure was:

http://www.domain.com/media/paper143/news/2005/03/22/OutAndAbout/My.Old.South.Philly.Home-899896.shtml

The new one is http://domain.com/2005/03/22/My-Old-South-Philly-Home

What is the easiest way to redirect the old to the new? Is there any way?(the old url is from an old CMS the new one is Wordpress)
posted by Blandanomics to Technology (4 answers total) 3 users marked this as a favorite
 
Best answer: Here's a Wordpress plugin. I have not used it tho.
posted by loiseau at 4:00 PM on February 13, 2008


If that wordpress plugin doesn't work out for you, you might have to create your own rules using ModRewrite. Make sure your host supports Modrewrite and your .htaccess is enabled.

Note: there are probably already rules enabled to allow the clean urls provided by wordpress in the first place, you might just have to add some new ones.
posted by puddpunk at 4:25 PM on February 13, 2008


Mod-rewrite is your friend.

The regular expression to rewrite is going to be something like the following (untested and perl regular expression syntax so probably wrong for mod_rewrite):

from:

http://www.domain.com/media/paper143/news/(\d{4}/\d{2}/\d{1,2})/OutAndAbout/(\w|\.)-\d+.shtml

to:

http://www.domain.com/$1/$2

note you need an extra bit of logic to translate the dots in the first version of the end of the url ($2) to dashes in the new version.

Anyway that's a start with mod_rewrite.
posted by singingfish at 4:34 PM on February 13, 2008


How about a 301 redirect?
posted by Taken Outtacontext at 10:12 AM on February 14, 2008


« Older Repeat after me. Write down the movies you see.   |   Who is Ann Marie Brown? Newer »
This thread is closed to new comments.