Yazılım

WordPress optimizasyon – htaccess optimizasyon

WordPress htaccess optimizasyonu

Htaccess nedir ?

Htaccess, Hypertext Access ve Apache başta olmak üzere çoğu ağ sunucusu tarafından kullanılan web alanı üzerinde ayar değişimleri ve siteleri yapılandırmasını sağlayan gövde mekanizmalı bir sistemdir.

WordPress cache, etag control ve hızlandırma yapmak için kodları derledik.

Bu kodları htaccess kodlarınıza ekleyin.

### MIME TYPES ###
AddType video/x-flv .flv
AddType application/x-shockwave-flash .swf
AddType image/x-icon .ico
AddType image/svg+xml svg
AddType text/cache-manifest .manifest

#=============================================================================#
# HEADERS, CACHING AND OPTIMIZATION
#=============================================================================#
#-> http://www.htaccesselite.com/htaccess/cache-control-http-headers-vt65.html
# 300 5 M
# 2700 45 M
# 3600 1 H
# 54000 15 H
# 86400 1 D
# 518400 6 D
# 604800 1 W
# 1814400 3 W
# 2419200 1 M
# 26611200 11 M
# 29030400 1 Y (never expire)
###########

#### HEADER CACHING ####
#-> http://www.htaccesselite.com/htaccess/caching-using-header-vt2.html
<FilesMatch “\.(flv|gif|jpg|jpeg|png|ico)$”>
Header set Cache-Control “max-age=29030400”
</FilesMatch>
<FilesMatch “\.(js|css|pdf|swf)$”>
Header set Cache-Control “max-age=29030400”
</FilesMatch>
<FilesMatch “\.(html|htm|txt)$”>
Header set Cache-Control “max-age=29030400”
</FilesMatch>
<FilesMatch “\.(pl|php|cgi|spl|scgi|fcgi)$”>
Header unset Cache-Control
</FilesMatch>

### ALTERNATE EXPIRES CACHING ###
#-> htaccesselite.com/d/use-htaccess-to-speed-up-your-site-discussion-vt67.html
ExpiresActive On
ExpiresDefault A29030400
ExpiresByType image/x-icon A29030400
ExpiresByType application/x-javascript A29030400
ExpiresByType text/css A29030400
ExpiresByType text/html A29030400
<FilesMatch “\.(pl|php|cgi|spl|scgi|fcgi)$”>
ExpiresActive Off
</FilesMatch>

#compress text, html, javascript, css, xml:
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

#Cache navigateur # 1 semaine
Header set Cache-Control “max-age=604800, public”

<IfModule mod_gzip.c>
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
AddEncoding gzip .gzip
mod_gzip_on YES
mod_gzip_handle_methods GET
mod_gzip_temp_dir /tmp
mod_gzip_can_negotiate Yes
mod_gzip_dechunk Yes
mod_gzip_send_vary On
mod_gzip_update_static No
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 250
mod_gzip_maximum_file_size 1048576
mod_gzip_maximum_inmem_size 60000
mod_gzip_min_http 1000
mod_gzip_item_exclude reqheader “User-agent: Mozilla/4.0[678]”
mod_gzip_item_exclude file .js$
mod_gzip_item_exclude file .css$
mod_gzip_item_exclude mime ^application/pdf$
mod_gzip_item_exclude mime ^image/
mod_gzip_item_exclude mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include file .html$
mod_gzip_item_include file .pl$
mod_gzip_item_include file .cgi$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include mime ^application/postscript$
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A29030400
ExpiresByType image/x-icon A29030400
ExpiresByType application/x-javascript A29030400
ExpiresByType application/javascript A29030400
ExpiresByType text/javascript A29030400
ExpiresByType text/css A29030400
ExpiresByType image/gif A29030400
ExpiresByType image/png A29030400
ExpiresByType image/jpeg A29030400
ExpiresByType text/plain A29030400
ExpiresByType application/x-shockwave-flash A29030400
ExpiresByType video/x-flv A29030400
ExpiresByType application/pdf A29030400
ExpiresByType text/html A29030400

ExpiresActive On
ExpiresDefault “access plus 1 seconds”
ExpiresByType image/x-icon “access plus 29030400 seconds”
ExpiresByType image/jpeg “access plus 29030400 seconds”
ExpiresByType image/png “access plus 29030400 seconds”
ExpiresByType image/gif “access plus 29030400 seconds”
ExpiresByType application/x-shockwave-flash “access plus 29030400 seconds”
ExpiresByType text/css “access plus 29030400 seconds”
ExpiresByType text/javascript “access plus 29030400 seconds”
ExpiresByType application/x-javascript “access plus 29030400 seconds”
ExpiresByType text/html “access plus 29030400 seconds”
ExpiresByType application/xhtml+xml “access plus 29030400 seconds”
</IfModule>

<ifModule mod_headers.c>
Header set Cache-Control “max-age=29030400, public”
Header set Cache-Control “max-age=29030400, public”
Header set Cache-Control “max-age=29030400, private”
Header set Cache-Control “max-age=29030400, private, must-revalidate”

Header unset ETag

Header unset Last-Modified
</ifModule>

FileETag None

Tags

Kaan GİRGİN

Ben Kaan GİRGİN, 1996 Balıkesir doğumluyum 2013 yılından beri kendimi sanal Dünyada geliştiriyorum. Sürekli olarak yeni bilgiler edinip deneyimlerimi bu site üzerinden sizler ile paylaşıyorum.

İlgili Makaleler

Kimler Neler Demiş?

avatar
  Subscribe  
Bildir

Bu yazımızada bakın

Kapat
Kapat