2012-12-14 3 views
6

gzip 수축 문제를 푸는데 약 48 시간이 걸리며 도움을 요청해야 할 수도 있음을 알았습니다.mod는 루트의 하위 디렉토리를 압축하지 않음

마침내 내 php.ini 파일에서 압축을 켜야한다는 것을 알게 된 후 .htaccess를 통해 공유 된 유닉스 서버에서 사용할 수축 모듈을 얻었습니다.

PageSpeed는 내 루트 HTML이 사이트의 gzip으로 인코딩되었으며 Wordpress 사이트 theoleandersofsanleon.com에 대해 77.3 %의 압축을 얻었지만 어떤 하위 디렉토리의 파일도 압축하지 않고 있다는 것을 알려줍니다 (주로 css 및 js 내 wordpress 디렉토리에있는 파일들과 하위 디렉토리들).

필자는 필연적이라고 생각하지는 않았지만 디렉티브 디렉 토리를 사용하려고 시도한 다음 위치를 사용하지 않으려 고 시도했습니다.

모든 서버 사양에 대해 알아야 할 경우 루트에 phpinfo.php 파일을 넣습니다. 여기

내가 내 htdocs에 디렉토리와 워드 프레스 디렉토리 모두 내 htaccess로 파일에있는 것입니다 :

<IfModule mod_deflate.c> 
# Insert filters 
AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 
AddOutputFilterByType DEFLATE application/x-httpd-php 
AddOutputFilterByType DEFLATE application/x-httpd-fastphp 
AddOutputFilterByType DEFLATE image/svg+xml 

# Drop problematic browsers 
BrowserMatch ^Mozilla/4 gzip-only-text/html 
BrowserMatch ^Mozilla/4\.0[678] no-gzip 
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 

# Make sure proxies don't deliver the wrong content 
Header append Vary User-Agent env=!dont-vary 
</IfModule> 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

어떤 자세한 정보가 필요하고, 어떤 도움을 주셔서 대단히 감사 있으면 알려 주시기 바랍니다, 대단히 감사 드리며 머리카락을 다시 자랄 수있게 할 것입니다. 8-)

+0

응답 해 주셔서 감사합니다. 나는, Gzip으로 2.0 그러나 아파치 후 사용되지 새로운이었다 Gzip으로 대한 설명서를 읽어 약 12 ​​시간 동안 수축과 내가 읽은 모든 단일 것은 Gzip으로는 (아파치 1.3와 함께 사용) 이전 버전을이었다 계약에 있었고, 수축 이 모든 문서가 잘못되지 않았다는 것을 의미하지는 않습니다. 적어도 5 가지 다른 방법으로 .htaccess에서 압축을 사용하고 zlip 출력을 켜기 전까지는 작동하지 않습니다. 또한 브라우저 캐시를 삭제하는 과정의 모든 단계를 거쳤습니다. 내가 묻는 질문에 대한 정보가 있습니까? 응답 해 주셔서 다시 한 번 감사드립니다. –

+0

죄송합니다. 당신이 올바른지. mod_deflate는 mod_gzip에 우선합니다. 내 방어막 인 mod_deflate에서 실제로 gzip을 그 이름과 반대로 사용하고는 있지만 왜 내가 그것을 작성했는지 나는 모른다. 다른 사람들을 혼동하지 않도록 내 의견을 삭제하겠습니다. – Gerben

+0

문제 없습니다. 이상한 일이 있었는데, php.ini 파일을 보았습니다. mod_deflate가 설치되었다는 것을 알았 더라면, 제 서버가 아파치 1.3.42를 돌리고 있다고해도 말이죠. 어느 쪽이든, 나는 htaccess에서 지시문을 제거하고 WT3C를 설치했다. 이제는 Gzip (1.3 용)을 사용하고 있으며 내 CSS와 js를 모두 압축하지만 내 홈페이지 html, LOL은 압축하지 않습니다. 그래서 지금은 원래의 것과 정반대의 문제가 있습니다. 8-) 아, 사이트가 조금 더 빨라졌습니다. 결국 양 방정식을 구할 수 없는지 알게 될 것입니다. –

답변

0

최상위 .htaccess 파일에서 사용해보십시오. cPanel에서 옵티 마이저를 사용할 때 생성되는 내용입니다.

<IfModule mod_deflate.c> 
    SetOutputFilter DEFLATE 
    <IfModule mod_setenvif.c> 
    # Netscape 4.x has some problems... 
    BrowserMatch ^Mozilla/4 gzip-only-text/html 

    # Netscape 4.06-4.08 have some more problems 
    BrowserMatch ^Mozilla/4\.0[678] no-gzip 

    # MSIE masquerades as Netscape, but it is fine 
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 

    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 
    # the above regex won't work. You can use the following 
    # workaround to get the desired effect: 
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 

    # Don't compress images 
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary 
    </IfModule> 

    <IfModule mod_headers.c> 
    # Make sure proxies don't deliver the wrong content 
    Header append Vary User-Agent env=!dont-vary 
    </IfModule> 
</IfModule> 
+0

안녕하세요. 의견을 보내 주셔서 감사합니다. WT3C를 설치 한 후 htaccess 파일에 다 포함 된 것 같습니다. 여기가 (여전히 압축 CSS와 JS gzip으로 테스트가 실패) 지금 스탠드로 내 htaccess로는 다음과 같습니다 http://theoleandersofsanleon.com/stack/htaccessStack.txt 다시 한 번 감사드립니다. –

+1

내가 볼 수있는 htaccess 파일에는 이상한 점이 없습니다. 내가 생각하기에 가장 좋은 점은 아파치 업데이트이다. 솔직히 말해서, 내가 시도해 볼만한 것이지만 전혀 달라지지 않을 것이라고 확신하지는 않는다. – Mark

+0

굉장하다. Mark를 확인해 주셔서 감사합니다. 정말 고마워. 나는 나의 호스트와 상담하여 왜 그들이 옛날 Apace를 실행하고 있는지보고자한다. –