htaccess setting environment variable

I'm trying to get following code to work, but it seems like the environment variable SETEXPIRE is never set. If I remove the IfDefine SETEXPIRE part it works, but I need that part.

Options +FollowSymLinks -MultiViews

# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} (^|&)_=(.*)
RewriteRule .* - [E=SETEXPIRE:yes]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^html/(.*?)$ index.php?url=$1&%{QUERY_STRING} [L,NC]

<IfDefine SETEXPIRE>
    <filesMatch "(?!\.(png|jpe?g|css|js|gif))$">
        <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresDefault "access plus 3 months"

            <IfModule mod_headers.c>
                Header set Cache-Control "max-age=2592000, public, no-transform"
                Header set pragma ""
            </IfModule>
        </IfModule>
    </filesMatch>
</IfDefine>

Any help would be appreciated.

what im trying to do is to set expire header if the file extension requested is one of png|jpe?g|css|js|gif and key _ is set in the query string

Answers


thnx to mike i found a solution:

 Options +FollowSymLinks -MultiViews
 # Turn mod_rewrite on
 RewriteEngine On
 RewriteBase /

 RewriteCond %{QUERY_STRING} (^|&)_=(.*)
 RewriteCond %{QUERY_STRING} !(^|&)_=0(&|$)
 RewriteRule .* - [E=SETEXPIRE:yes]

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^html/(.*?)$ index.php?url=$1&%{QUERY_STRING} [L,NC]

 <filesMatch "(?!\.(png|jpe?g|css|js|gif))$">
       Header set Cache-Control "max-age=2592000, public, no-transform" env=SETEXPIRE
       Header set pragma "" env=SETEXPIRE
  </filesMatch>

cheers c_bb


Need Your Help

Pyplot: vertical gradient fill under curve?

python matplotlib gradient

I'm wondering if there's a way to fill under a pyplot curve with a vertical gradient, like in this quick mockup:

python "up-button" command completion, matlab/julia style

python matlab python-interactive interactive-shell

I recently switched from Matlab to Numpy and love it. However, one really great thing I liked about Matlab was the ability to complete commands. There are two ways that it does this: