.htaccess 破坏了我的网站

.htaccess breaking my site

我正在尝试使用 Google Analytic 的网站速度建议来优化我的网站,它给我的建议之一是在我的 .htaccess 文件中利用浏览器缓存。

在对 .htaccess 进行一些研究后,我发现我的站点没有。我创建了自己的 .htaccess 并用以下文本填充它:

AllowOverride All

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

我将它上传到我的网站,现在当加载我网站上的任何页面时,我收到一个错误页面,内容如下:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable 
to complete your request.

Please contact the server administrator, [no address given] and inform them 
of the time the error occurred, and anything you might have done that may 
have caused the error.

More information about this error may be available in the server error log.

知道是什么原因造成的吗?我是新来的,所以任何帮助将不胜感激!

删除或注释掉这一行

AllowOverride All

因为 htaccess 中不允许使用此指令。它仅在 Apache 配置中允许,因此此行的存在导致内部 500 错误。