1

I'm rewriting using htaccess like:

# ENABLE REWRITE
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteRule ^gallery/(.+)$ /image.php?image=$1 [L,QSA,NC]

# EXPIRES CACHING
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>

As you can see, I'm also setting expire period using .htaccess. Expire works if I remove line RewriteRule ^gallery/(.+)$ /image.php?image=$1 [L,QSA,NC], but then obviously I will have problem with rewriting. How can I combine this two things to play well together?

I'm on LiteSpeed server.

RhymeGuy
  • 2,102
  • 5
  • 32
  • 62

1 Answers1

1

You can try this FilesMatch directive for the rewritten PHP file:

<FilesMatch "image\.php$">
    ExpiresDefault "access plus 1 year"
</FilesMatch>
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Its still the same :( – RhymeGuy Dec 12 '13 at 18:52
  • www.mydomain.com/gallery/thumbnails/some_thumbnail-160x120.jpg – RhymeGuy Dec 12 '13 at 21:36
  • Yes, I have tried that with no luck. Till now, I had only luck with this: Header set Expires "Tue, 16 Jun 2020 20:00:00 GMT". If i set that in .htaccess, then expire headers will be set properly. Otherwise, they are not. – RhymeGuy Dec 12 '13 at 22:01