I have the following rules in my .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^index\.php$
RewriteRule ^(.*)$ index.php?q=$1 [L]
</IfModule>
This sets the query string value q
to the request uri (stripping any preceding directories before the one that index.php resides in).
For example: http://localhost/framework/testing
sets q=testing
.
I would like to change this so that instead of setting a query string, I would like to set an environment variable. I have tried the following but it does not work (the environment var does not get set):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^index\.php$
RewriteRule ^(.*)$ index.php [ENV=request:$1,L]
</IfModule>
Oddly enough, the environment var will get set if the request starts with index.php, for example: http://localhost/framework/index.php/testing
sets q=index.php/testing