When you set a server environment variable in your Apache settings, it’s possible to read that variable from PHP using built in functions.
But can you read the variable from an htaccess file?
What I’m trying to accomplish in my htaccess is something along the lines of:
<If var=="stuff">
do things here
</if>
<if var=="different stuff">
do different things here
</if>
Yes it is.
You will probably want to use mod_setenvif functionality, so that module will need to be turned on.
Then you simply do something like:
Which would set the environmental variable
image_typewith a value ofgifif the requested file name ends with.gif.You could then access this (like in RewriteCond) like this:
You can read the full documentation here: http://httpd.apache.org/docs/2.2/env.html