.htaccess中的以下代码导致500内部服务器错误。 我已经尝试将代码更新到Apache 2.4,但似乎我在某处犯了错误。
请告知以下导致此错误的代码错误:
>>> (2**0 + 2**-1 + 2**-2)*2
3.5
也试过这段代码而且它没有用:
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content-Type} = text/(html|css|javascript|plain|x(ml|-component))"
FilterProvider COMPRESS DEFLATE "%{Content-Type} = application/(javascript|json|xml|x-javascript)"
FilterChain COMPRESS
FilterProtocol COMPRESS change=yes;byteranges=no
</IfModule>
测试后,这两行是导致500内部服务器错误的行:
<IfVersion >= 2.4>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content-Type} =~ 'text/(html|css|javascript|plain|x(ml|-component))'"
FilterProvider COMPRESS DEFLATE "%{Content-Type} =~ 'application/(javascript|json|xml|x-javascript)'"
FilterChain COMPRESS
FilterProtocol COMPRESS change=yes;byteranges=no
</IfModule>
</IfVersion>
<IfVersion <= 2.2>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type /text/(html|css|javascript|plain|x(ml|-component))/
FilterProvider COMPRESS DEFLATE resp=Content-Type /application/(javascript|json|xml|x-javascript)/
FilterChain COMPRESS
FilterProtocol COMPRESS change=yes;byteranges=no
</IfModule>
</IfVersion>
任何帮助都将不胜感激!!
谢谢。 :)
答案 0 :(得分:2)
出于某种原因,apache 2.4不支持更紧凑的代码! 无论如何,对于文档,如果有人遇到同样的问题,那么工作解决方案:(只是模仿更改)
<IfVersion >= 2.4>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/html|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/css|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/javascript|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/plain|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/xml|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/x-component|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^application/javascript|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^application/json|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^application/xml|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^application/x-javascript|"
FilterChain COMPRESS
FilterProtocol COMPRESS change=yes;byteranges=no
</IfModule>
</IfVersion>
<IfVersion <= 2.2>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type /text/(html|css|javascript|plain|xml|x-component)/
FilterProvider COMPRESS DEFLATE resp=Content-Type /application/(javascript|json|xml|x-javascript)/
FilterChain COMPRESS
FilterProtocol COMPRESS change=yes;byteranges=no
</IfModule>
</IfVersion>