服务器错误! .htaccess文件的错误500

时间:2015-03-10 06:28:18

标签: php apache .htaccess mod-rewrite opencart

我使用Opencart购物系统并拥有此.htaccess文件:

# STARTNITRO
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
ExpiresActive On

#CSS JS XML TXT - 1 WEEK
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, public"
ExpiresDefault "access plus 1 week"
</FilesMatch>

#JPG JPEG PNG GIF SWF SVG - 1 MONTH
<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header set Cache-Control "max-age=2674800, public"
ExpiresDefault "access plus 1 month"
Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT"
</FilesMatch>

#OTF WOFF TTF ICO PDF FLV - 1 MONTH
<FilesMatch "\.(otf|ico|pdf|flv|woff|ttf)$">
Header set Cache-Control "max-age=2674800, public"
ExpiresDefault "access plus 1 month"
</FilesMatch>
# ENDNITRO
# STARTCOMPRESSNITRO

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.css$ assets/style.php?l=9&p=$1&c=604800 [NC,L]

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.js$ assets/script.php?l=9&p=$1&c=604800 [NC,L]

现在,当我看到我的页面时,我看到错误:

Server error! The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.If you think this is a server error, please contact the webmaster. Error 500

我该如何修复此错误?!

1 个答案:

答案 0 :(得分:2)

  

[Mon Mar 09 23:08:08.289609 2015] [core:alert] [pid 4856:tid 1668] [client :: 1:53855] C:/xampp/htdocs/shop/.htaccess:无效命令'ExpiresActive ',可能拼写错误或由未包含在服务器配置中的模块定义

这意味着您没有加载mod_expires。您需要在httpd.conf中取消注释掉该行,或者如果有,请使用a2enmod。确保重启apache。

请参阅此答案:Apache crashing when I add Far-Future Expires clause from Rails Guide