Page 1 of 1
Variables in RewriteRule
Posted: Tue Oct 07, 2008 2:37 am
by alex.barylski
I have declared a environment variable in my .htaccess something like:
Code: Select all
SetEnv default_arg "jump"
RewriteEngine on
RewriteRule ^([a-z0-9\-]+)\.php$ index.php?{%default_arg%}=$1 [QSA]
Is something like this possible?
Re: Variables in RewriteRule
Posted: Tue Oct 07, 2008 5:15 am
by VladSun
Something like that?
http://httpd.apache.org/docs/1.3/mod/mo ... ewriteCond
http://httpd.apache.org/docs/2.0/mod/mo ... ewriteCond
There is the special format: %{ENV:variable} where variable can be any environment variable. This is looked-up via internal Apache structures and (if not found there) via getenv() from the Apache server process.
And ... what's the main idea of doing this?
Re: Variables in RewriteRule
Posted: Wed Oct 08, 2008 6:05 am
by alex.barylski
Just experimenting right now...

Re: Variables in RewriteRule
Posted: Wed Oct 08, 2008 6:05 am
by alex.barylski
Just experimenting right now...
Edit | Thanks again BTW