Home 워드프레스 .htaccess 빠른 캐시설정 세팅

.htaccess 빠른 캐시설정 세팅

by maxblog
0 comment
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</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>



 <IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
 
  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4.0[678] no-gzip
  BrowserMatch bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>


<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
 
<FilesMatch ".(txt|xml|js)$">
ExpiresDefault A691200
</FilesMatch>
 
<FilesMatch ".(css)$">
ExpiresDefault A691200
</FilesMatch>
 
<FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
ExpiresDefault A691200
</FilesMatch>
 
<FilesMatch ".(jpg|jpeg|png|gif|swf|webp)$">
ExpiresDefault A691200
</FilesMatch>
</IfModule>
 
<IfModule mod_headers.c>
<FilesMatch ".(txt|xml|js)$">
Header set Cache-Control "max-age=691200"
</FilesMatch>
 
<FilesMatch ".(css)$">
Header set Cache-Control "max-age=691200"
</FilesMatch>
 
<FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
Header set Cache-Control "max-age=691200"
</FilesMatch>
 
<FilesMatch ".(jpg|jpeg|png|gif|swf|webp)$">
Header set Cache-Control "max-age=691200"
</FilesMatch>
</IfModule>


# END WordPress


# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

이렇게 기본설정과 세팅을 해주고 서버랑 잘맞으면 속도가 무지 빨라진다.
오류가 나는 경우 .htaccess 파일을 지워보고 한다음
그대로 안맞으면 다른 .htaccess파일로 바꿔본다.
문제가 안맞으면 완전 초간단 기본 코드만 있는 .htaccess 파일을 업로드해서 우선 접속되게 만든다.
기본 .htaccess는 곧 여기 블로그에 업로드 예정.

위파일도 중복되는 부분 편집해서 다시 올릴 예정이다.

좋아할만한 추천 글

Leave a Comment

Soledad is the Best Newspaper and Magazine WordPress Theme with tons of options and demos ready to import. This theme is perfect for blogs and excellent for online stores, news, magazine or review sites.

Buy Soledad now!

Edtior's Picks

Latest Articles

ⓒ 2023.  FUNCOM all rights reserved.