-1
Google PageSpeedなどのキャッシュチェックサイトは、2時間だけキャッシュされたファイルを表示し続けます。私のhtaccessファイルに何か問題がありますか?ルールの順序?ありがとう私の.htaccessコードが間違っていますか?
- ファイルの他のすべてのルールが動作します。 (まあ、どちらも動作していないと思われるETagsを無効にするコードがありました)
- 私はCloudFlareを使用していますが、キャッシュタイムに影響を与えるものは何もありません。
AddCharset UTF-8 .html
RewriteEngine on
RewriteOptions inherit
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301,NC]
################ Require ending trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ %{REQUEST_URI}/ [R=301,L]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>
## EXPIRES CACHING ##
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
## ENABLE COMPRESSION ##
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddType application/x-httpd-php .html .htm
ErrorDocument 404 /404.php
ErrorDocument 410 /410.php
私は、Apacheの設定ファイルでのバーチャルホストのためmod_expiresをオーバーライド設定がありました、いくつかのRewriteCondの
mod_expiresが有効になっていますか? ''はそうでなければスキップされます。周囲の ' '行をコメントアウトして 'Expires'を強制的に実行させます - 500エラーで爆発しますか? –
あなたの投稿を編集してドメインを書き換えルールから削除するようお勧めします。あなたがそのまま残すと、これはスパム投稿と誤解される可能性があります。 –