为什么我会收到错误500?它是由.htaccess
文件
RewriteEngine On
RewriteBase /
AddDefaultCharset UTF-8
<IfModule mod_expires.c>
Header set cache-control: public
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 1 days"
ExpiresByType application/rss+xml "access plus 1 week"
ExpiresByType image/png "access plus 10 month"
ExpiresByType image/jpg "access plus 10 month"
ExpiresByType image/jpeg "access plus 10 month"
ExpiresByType image/gif "access plus 10 month"
ExpiresByType video/ogg "access plus 10 month"
ExpiresByType audio/ogg "access plus 10 month"
ExpiresByType video/mp4 "access plus 10 month"
ExpiresByType image/x-icon "access plus 10 month"
ExpiresByType font/ttf "access plus 10 month"
ExpiresByType image/svg+xml "access plus 10 month"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
删除两个部分
<IfModule mod_headers.c>
<IfModule mod_expires.c>
解决问题。
我使用XAMPP,这些模块存在于\xampp\apache\modules
:
mod_expires.so
mod_headers.so
两者都加载了\xampp\apache\conf\httpd.conf
:
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
服务器已重新启动。