Can mod_rewrite do math?

Posted by ewall on Stack Overflow See other posts from Stack Overflow or by ewall
Published on 2010-06-17T16:24:48Z Indexed on 2010/06/17 17:03 UTC
Read the original article Hit count: 307

Filed under:
|
|

I am planning to convert my website to a new CMS, but I would like to use mod_rewrite to seamlessly redirect old links to their new locations.

The catch is that my new blog will not have the same article numbers as the old, because I'll import some older blog entries in their first. Thus, my mod_rewrite would need to take a URL like old.php?article=125, do the addition to figure out the new article number (say +200, for this example), and redirect to new.php?i=325.

Can mod_rewrite do the addition on its own, or am I going to need some kind of 'helper' script to do that?

© Stack Overflow or respective owner

Related posts about regex

Related posts about apache