Apache 利用浏览器缓存-修改.htaccess文件时出现内部服务器错误
我正在努力加快我的网站。在google PageSpeed Insights上,我有86点,但我在Apache 利用浏览器缓存-修改.htaccess文件时出现内部服务器错误,apache,.htaccess,mod-expires,Apache,.htaccess,Mod Expires,我正在努力加快我的网站。在google PageSpeed Insights上,我有86点,但我在利用浏览器缓存方面有问题。在推荐中,我找到了这段.htaccess代码: ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" Exp
利用浏览器缓存方面有问题。在推荐中,我找到了这段.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 ##
我做错了什么?我认为您应该在服务器上启用模块“mod_expires”:
使用ubuntu服务器类型:
a2enmod过期
/etc/init.d/apache2 restart你能检查你的Apache error.log,看看错误是什么吗?不幸的是我不能-那不是我的服务器很有趣,你想修复一个“错误”,但你找不到错误是什么。我可以找到,但是明天-我必须等待管理员,同时尝试注释AddHandler x-httpd-php53.php
行,看看这是否有帮助。
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