服务器错误! .htaccess 文件错误 500
Server error! error 500 for .htaccess file
我使用 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=&c=604800 [NC,L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.js$ assets/script.php?l=9&p=&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
我该如何解决这个错误?!
[Mon Mar 09 23:08:08.289609 2015] [core:alert] [pid 4856:tid 1668] [client ::1:53855] C:/xampp/htdocs/shop/.htaccess: Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration
这意味着您没有 mod_expires 加载。您需要取消注释 httpd.conf 中的那一行,或者如果有的话使用 a2enmod
。确保重新启动 apache。
看到这个答案:Apache crashing when I add Far-Future Expires clause from Rails Guide
我使用 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=&c=604800 [NC,L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.js$ assets/script.php?l=9&p=&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
我该如何解决这个错误?!
[Mon Mar 09 23:08:08.289609 2015] [core:alert] [pid 4856:tid 1668] [client ::1:53855] C:/xampp/htdocs/shop/.htaccess: Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration
这意味着您没有 mod_expires 加载。您需要取消注释 httpd.conf 中的那一行,或者如果有的话使用 a2enmod
。确保重新启动 apache。
看到这个答案:Apache crashing when I add Far-Future Expires clause from Rails Guide