0

サイトを高速化しようとしています。Google PageSpeed Insights では 86 ポイントを獲得しましたが、Leverage browser caching. .htaccess推奨事項として、次のコードを見つけました。

## 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 2 days"
</IfModule>
## EXPIRES CACHING ##

しかし、.htaccessファイルに挿入すると、Internal Server Error (500) が発生します。

私の作業.htaccessコードは次のようになります。

AddHandler x-httpd-php53 .php 

RewriteEngine On
RewriteBase /
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php

# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4         gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE             !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

私が間違っていることは何ですか?

4

1 に答える 1

0

サーバーでモジュール「mod_expires」を有効にする必要があると思います:ubuntuサーバータイプを使用:

a2enmod の有効期限が切れる

/etc/init.d/apache2 再起動

于 2016-06-22T13:15:50.420 に答える