I am using a perl script file as a map file in RewriteMap directive. As i read the apache load the script once at the beginning, So is it needed to reload or restart apache after any changes to this script file?
2 Answers
Yes, rewrite maps are only registered when Apache is starting. And when using external programs as rewrite maps (i.e. map type pgr
) the program files need to be locked with RewriteLock
:
This directive sets the filename for a synchronization lockfile which mod_rewrite needs to communicate with
RewriteMap
programs. Set this lockfile to a local path (not on a NFS-mounted device) when you want to use a rewriting map-program. It is not required for other types of rewriting maps.
But the other map types can be changed afterwards:
For plain text and DBM format files the looked-up keys are cached in-core until the mtime of the mapfile changes or the server does a restart. This way you can have map-functions in rules which are used for every request. This is no problem, because the external lookup only happens once!

- 643,351
- 109
- 780
- 844
I'm not sure if the response above is correct, reload seems to be fine.
You can do "ps aux | grep YOUR_REWRITE_PROGRAM" to check the PID/start time of your rewrite map program.
Apache reload seems to set a new PID/start time for these processes, so I would assume new processes have started, a reload may be fine.

- 11
- 1