apachemod-rewriterewritemap

is restarting apache service needed with any changes to rewritemap file?


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?


Solution

  • 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!