I wish to redirect some web addresses with id = n to id = n + 1000 (where n is really a variable). After doing a search online I discovered will be able to do that utilizing a prg type RewriteMap directive.

However, I went into some trouble setting it up to operate. The code I'm using to check utilizing a custom RewriteMap is incorporated below.

This really is my test.pl file that I am using because the map program:

$| = 1; # Turn off buffering
while (<STDIN>) {
    print $_;

I have defined the RewriteMap during my virtualhost.conf file:

RewriteMap prp prg:/var/www/mydomain1.com/test.pl

Which is the RewriteRule where I am using my custom map:

RewriteRule ^Pro-id-([0-9]+).html http://mydomain2.um.ac.ir/papers-${prp:$1}.html [L,R=301]

Things I expect this code (test.pl) to complete would be to return exactly the same id, however it returns null. What's the problem?

The items you have is simply fine, a rewritelog with rewriteloglevel 5 or greater would most likely demonstrate that another rewrite or config gets in the manner.