【发布时间】:2012-02-04 21:19:43
【问题描述】:
不久前,我从 xampp 转到 wamp
现在,当我进入我的网站时,出现了这个错误:
内部服务器错误 服务器遇到内部错误或配置错误,无法完成您的请求。 请联系服务器管理员 admin@localhost 并告知他们错误发生的时间,以及您所做的任何可能导致错误的事情。 服务器错误日志中可能提供有关此错误的更多信息。
当我在 .htaccess 中使用此代码时:
<FilesMatch "\.(pdf|swf|js|css)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(html|cgi|php|htm)$">
Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate"
Header set Pragma "no-cache"
</FilesMatch>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
<Files *.js>
SetOutputFilter DEFLATE
</Files>
<Files *.css>
SetOutputFilter DEFLATE
</Files>
我该如何解决这个问题?
我找到了 apache_error.log:
[2012 年 1 月 7 日星期六 13:58:06] [警报] [客户端 127.0.0.1] C:/wamp/www/website/.htaccess: 无效命令“标题”,可能拼写错误或由未包含的模块定义在服务器配置中,referer:localhost
【问题讨论】:
-
它需要有 mod_headers.c 。试试这样:
<IfModule mod_headers.c> Header set [your_options] </IfModule> -
我应该在“your_options”中写什么?
-
他提到了你之前发布的选项
-
你能给我举个“选项”的例子吗?我真的不知道我应该如何编写这段代码。我应该在哪里写这段代码,在 .htaccess 文件上?
标签: php .htaccess wamp wampserver