Software: libREV
Library for fake access to files from external app
Intercept open/stat system calls and substitute filename with original filename plus "-" and value of environment variable REV (if REV defined and such file accessible).
Usage:
$ export LD_LIBRARY_PATH=/path/to/libREV/:$LD_LIBRARY_PATH
$ export LD_PRELOAD=libREV.so
$ echo test1 > myfile.txt
$ echo test2 > myfile.txt-experimental
$ cat myfile.txt
test1
$ REV=experimental cat myfile.txt
test2
Usage example for apache. Set LD_PRELOAD before running apache, for
example in runit/daemontools ./run file:
exec env -i PATH=$PATH LD_PRELOAD=libREV.so apache2 ...
or in /etc/init.d/apache2:
LD_PRELOAD=libREV.so ${APACHE2} ${APACHE2_OPTS} -k start
Also, if you use FastCGI for running
your CGI scripts in separate daemon, you also should set LD_PRELOAD for
that FastCGI daemon.
Next, here is example of .htaccess configuration:
RewriteEngine on
RewriteRule ^-([^/]+)(/.*) $2 [E=REV:$1]
SetEnvIf REDIRECT_REV (.+) REV=$1 !REDIRECT_REV
PassEnv LD_PRELOAD