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.

4

1 回答 1

1

您可以为重写的 PHP 文件尝试此FilesMatch指令:

<FilesMatch "image\.php$">
    ExpiresDefault "access plus 1 year"
</FilesMatch>
于 2013-12-12T12:56:57.793 回答