【发布时间】:2015-02-15 02:30:33
【问题描述】:
您好,当我尝试在 wampserver 中运行我的代码时,我收到 500 内部服务器错误,该代码绝对可以运行 我的 .htaccess 文件位于 wamp/www/site 文件夹中,所有其他代码也在同一文件夹中 所以我应该把网站放在 .htaccess 文件中的某个地方,因为在线我的代码在根文件夹中 我的 .htaccess 代码:
RewriteEngine on
FileETag none
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
</IfModule>
Apache 错误在这里:
J:/wamp/www/site/.htaccess:无效命令“AddOutputFilterByType”,可能拼写错误或由未包含在服务器配置中的模块定义,引用:/site/about/
【问题讨论】:
-
RewriteEngine on FileETag none
RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R =301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-dAddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/ javascript 应用程序/x-javascript -
AddOutputFilterByType现在已弃用,根据您的配置,这可能是原因。查看stackoverflow.com/questions/5230202/… 了解更多信息 -
注释掉
<IfModule mod_deflate.c>块
标签: php apache .htaccess mod-rewrite httpd.conf