Forum Moderators: phranque

Message Too Old, No Replies

Redirecting UNfriendly URLs

Backwards problem -- old url has GET variables, new doesn't

         

meta4ic

6:12 pm on Mar 30, 2005 (gmt 0)

10+ Year Member



I've rebuilt an old site that used links along the lines of "/foo.php?article=22&mode=18" to use links like "/articles/about_widget_1/" instead.

The problem is that I'd still like to be able to handle old links and SE traffic that uses the old structure.

I tried doing this:

Redirect permanent /foo.php?article=22&mode=18 [example.com...]

(using one redirect line for each specific article, since there's no mapping between the old article number variable and the new title)

but Redirect doesn't appear to be attempting to do anything when handed that string with the GET variables.

Is there a way around this? I'm familiar with going the other direction (friendly url to GETs) with mod_rewrite, but I can't seem to find any discussion of anyone trying to rewrite old "unfriendly" urls.

Thanks!

meta4ic

7:48 pm on Mar 30, 2005 (gmt 0)

10+ Year Member



Nevermind; I was looking for a hammer when I needed a screwdriver...

Not enough coffee earlier, apparently. Sorry!

I took out my failed redirect rules and coded up a replacement foo.php that did a permanent redirect to the page I needed in each case.

dcrombie

9:18 am on Mar 31, 2005 (gmt 0)



Something like this would also work:

RewriteCond %{QUERY_STRING} "^article=22" 
RewriteRule ^foo\.php /articles/about_widget_1/ [R=301]