2007
02.12

For those of you who are into mod_rewrite, the following rule is incredibly useful and I thought I would post it up here for Googlers / prosperity:

When you want to redirect ALL requests which are formed out of a basic stem, you can use the following rule:

RewriteRule ^/oldthing(/.*)?$ /newthing [NC,R=301,L]

And bingo, all “old” urls (eg: /oldthing/bio.html) will be plonked straight down to /newthing. This is particularly useful if you have changed the mod_rewrite structure of your site and you are getting too many 404’s in your error_log.

Oh, and if you did happen upon this from Google, be sure to check out the great reference guide at www.ilovejackdaniels.com

No Comment.

Add Your Comment