programing

mod deflat 루트의 하위 디렉토리를 압축하지 않음

closeapi 2023. 9. 28. 08:23
반응형

mod deflat 루트의 하위 디렉토리를 압축하지 않음

저는 지프 감압 문제를 해결하기 위해 48시간 정도 노력하고 있고 도움을 요청해야 할 수도 있다는 것을 깨달았어요, 히히히히.

php.ini 파일에서 압축을 켤 필요가 있다는 것을 깨달은 후에 마침내 .htaccess를 통해 공유 유닉스 서버에서 디플레이트 모듈을 활성화했습니다.

페이지 스피드는 내 루트 HTML이 사이트에 대해 gzip으로 인코딩되어 있고 워드프레스 사이트 theoleandersofsanleon.com 에 대해 77.3% 압축을 받고 있지만 어떤 하위 디렉터리의 파일도 압축되지 않고 있습니다(내 워드프레스 디렉터리와 하위 디렉터리의 mainly CSS 및 js 파일).

저는 그것이 필요하다고 생각하지 않았지만, 저는 지시 디렉토리와 지시 위치를 사용하려고 했지만 소용이 없었습니다.

서버 사양을 확인해야 한다면 루트에 phpinfo.php 파일을 넣었습니다.

htdocs 디렉토리와 wordpress 디렉토리 모두에 대해 .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-)

상위 레벨 .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>

언급URL : https://stackoverflow.com/questions/13871156/mod-deflate-not-compressing-subdirectories-of-root

반응형