【问题标题】:.htaccess 500 Internal server Error in wamp.htaccess 500 wamp 中的内部服务器错误
【发布时间】: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} !-d AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/ javascript 应用程序/x-javascript
  • AddOutputFilterByType 现在已弃用,根据您的配置,这可能是原因。查看stackoverflow.com/questions/5230202/… 了解更多信息
  • 注释掉&lt;IfModule mod_deflate.c&gt;

标签: php apache .htaccess mod-rewrite httpd.conf


【解决方案1】:

如果你使用的是apache 2.4,你需要改变

<IfModule mod_deflate.c>

<IfModule mod_filter.c>

因为输出过滤器已移至 mod_filter。然后你需要确保你已经加载了 mod_filter。

【讨论】:

  • 感谢您的帮助 现在工作正常,但页面中没有任何 css 文件或 jQuery 文件....
  • @MPatel 确保您的链接是绝对 URL,或者您的页面标题中有 &lt;base href="/" /&gt;
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-08-13
  • 1970-01-01
  • 1970-01-01
  • 2016-09-22
  • 2017-04-05
  • 1970-01-01
相关资源
最近更新 更多