2014-02-13 3 views
1

내 호스트가 php2.xxx를 사용할 때 사이트를 압축했습니다. 이제는 php5.4로 간다. 압축은 더 이상 작동하지 않는다. PHP 사이트에서 찾을 수있는 것은 모두 문자열 압축이며 필요하지 않습니다. 이것은 내가.htaccess site compression with php5.4

<IfModule mod_deflate.c> 

# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing- beyond-gzipping/ 
<IfModule mod_setenvif.c> 
<IfModule mod_headers.c> 
    SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ 
^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 
    RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 
</IfModule> 
</IfModule> 

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC: 
<IfModule filter_module> 
FilterDeclare COMPRESS 
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html 
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css 
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain 
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml 
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject 
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml 
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon 
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf 
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype 
FilterChain  COMPRESS 
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no 
</IfModule> 

<IfModule !mod_filter.c> 
# Legacy versions of Apache 
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component 
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml 
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype 
</IfModule> 

</IfModule> 

을 사용하고 동시에 같은 호스트

으로이 개 사이트에 일이 뭐죠 업데이트 된 PHP와 함께 사용하기위한 새로운 방법은? 감사합니다. 내가 이것을 사용하고

+1

이것은'아파치'문제가 아니며,'아파치'를'mod_deflate'로 컴파일해야합니다. http://httpd.apache.org/docs/2.2/mod/mod_deflate.html – cmorrissey

+0

감사합니다. , 나는 너의 연결을 읽을 것이다 – Brad

답변

4

<IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE "application/atom+xml" \ 
            "application/javascript" \ 
            "application/json" \ 
            "application/ld+json" \ 
            "application/manifest+json" \ 
            "application/rdf+xml" \ 
            "application/rss+xml" \ 
            "application/schema+json" \ 
            "application/vnd.geo+json" \ 
            "application/vnd.ms-fontobject" \ 
            "application/x-font-ttf" \ 
            "application/x-javascript" \ 
            "application/x-web-app-manifest+json" \ 
            "application/xhtml+xml" \ 
            "application/xml" \ 
            "font/eot" \ 
            "font/opentype" \ 
            "image/bmp" \ 
            "image/svg+xml" \ 
            "image/vnd.microsoft.icon" \ 
            "image/x-icon" \ 
            "text/cache-manifest" \ 
            "text/css" \ 
            "text/html" \ 
            "text/javascript" \ 
            "text/plain" \ 
            "text/vcard" \ 
            "text/vnd.rim.location.xloc" \ 
            "text/vtt" \ 
            "text/x-component" \ 
            "text/x-cross-domain-policy" \ 
            "text/xml" 
</IfModule> 

이 시도 PHP 7에서 내 사이트 .htacces. 그것의 나를 위해 잘 작동합니다.