Cara Speed Up WordPress Site! – Trik Mempercepat WordPress

Tidak dipungkiri WordPress merupakan salah satu CMS yang sangat digemari oleh banyak orang/perusahaan dalam membangun blog personal maupun website skala besar. Selain membantu mempercepat waktu pengembangan web, WordPress tergolong mudah untuk di-maintenance dan banyak komunitas serta pengembang. Terlebih lagi banyak ketersediaan plugin dan tema. Bahkan data statiskik yang dirangkum oleh https://wordpress.com/activity/ Indonesia merupakan bahasa No. 3 yang paling banyak digunakan di blog WordPress.

Namun disisi kecepatan akses, website atau blog yang dibuat dengan WordPress sering kali terasa sangat lamban. Memang kecepatan akses bukan hanya dipengaruhi oleh website itu sendiri, terkadang ada faktor lain yang mempengaruhi seperti server/hosting atau internet. Ok kesampingkan dulu 2 faktor tersebut, disini saya akan coba memberi sedikit trik “Bagaimana cara merpercepat WordPress?”. Tentu saja trik yang akan saya berikan merupakan langkah optimalisasi dari segi WordPress-nya bukan dari segi server apalagi internetnya ya hhehe.

Sebelumnya, silahkan kalian cek Speed website kalian di https://gtmetrix.com/ dan https://developers.google.com/speed/pagespeed/insights/ untuk mencari tahu berapa score speed test website kamu. Sebenarnya di kedua website diatas suah terdapat rekomendasi untuk mengatasi website yang lamban, tapi disini akan saya beri rangkumannya.

  1. Langkan pertama, buat file .htaccess di folder root website kamu, seperti ini
    1
  2. Kemudian copy paste kode berikut
    # BEGIN W3TC Browser Cache
    
        
            Header append Vary User-Agent env=!dont-vary
        
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
        
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        
    
    <FilesMatch "\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$">
        FileETag MTime Size
        
            Header set Pragma "public"
            Header set Cache-Control "max-age=31536000, public"
        
    
    <FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
        FileETag MTime Size
        
            Header set Pragma "public"
            Header set Cache-Control "max-age=3600, public"
        
    
    <FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|woff|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|WOFF|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
        FileETag MTime Size
        
            Header set Pragma "public"
            Header set Cache-Control "max-age=31536000, public"
        
    
    # END W3TC Browser Cache
    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /ramadhansutejo/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /ramadhansutejo/index.php [L]
    
    
    # END WordPress
    
    # ------------------------------------------------------------------------------
    # | Expires headers                                                            |
    # ------------------------------------------------------------------------------
     
    # Serve resources with far-future expires headers.
     
    # IMPORTANT: If you don't control versioning with filename-based cache
    # busting, consider lowering the cache times to something like one week.
     
    
     
        ExpiresActive on
        ExpiresDefault                                      "access plus 1 month"
     
      # CSS
        ExpiresByType text/css                              "access plus 1 year"
     
      # Data interchange
        ExpiresByType application/json                      "access plus 0 seconds"
        ExpiresByType application/ld+json                   "access plus 0 seconds"
        ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
        ExpiresByType application/xml                       "access plus 0 seconds"
        ExpiresByType text/xml                              "access plus 0 seconds"
     
      # Favicon (cannot be renamed!) and cursor images
        ExpiresByType image/x-icon                          "access plus 1 week"
     
      # HTML components (HTCs)
        ExpiresByType text/x-component                      "access plus 1 month"
     
      # HTML
        ExpiresByType text/html                             "access plus 0 seconds"
     
      # JavaScript
        ExpiresByType application/javascript                "access plus 1 year"
     
      # Manifest files
        ExpiresByType application/manifest+json             "access plus 1 year"
        ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
        ExpiresByType text/cache-manifest                   "access plus 0 seconds"
     
      # Media
        ExpiresByType audio/ogg                             "access plus 1 month"
        ExpiresByType image/gif                             "access plus 1 month"
        ExpiresByType image/jpeg                            "access plus 1 month"
        ExpiresByType image/png                             "access plus 1 month"
        ExpiresByType video/mp4                             "access plus 1 month"
        ExpiresByType video/ogg                             "access plus 1 month"
        ExpiresByType video/webm                            "access plus 1 month"
     
      # Web feeds
        ExpiresByType application/atom+xml                  "access plus 1 hour"
        ExpiresByType application/rss+xml                   "access plus 1 hour"
     
      # Web fonts
        ExpiresByType application/font-woff                 "access plus 1 month"
        ExpiresByType application/font-woff2                "access plus 1 month"
        ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
        ExpiresByType application/x-font-ttf                "access plus 1 month"
        ExpiresByType font/opentype                         "access plus 1 month"
        ExpiresByType image/svg+xml                         "access plus 1 month"
     
    
    
    
    
    ## ENABLE GZIP COMPRESsION ##
    
      # 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
    
    ## ENABLE GZIP COMPRESsION ##
    
    ## ENABLE KEEP ALIVE ##
    
        Header set Connection keep-alive
    
    ## ENABLE KEEP ALIVE ##

Nih saya kasih liat penampakan speed score blog saya 🙂
31

21

Ok, sekian trik kali ini, untuk penjelasan mengenai kode diatas dan cara lain agar WordPress kamu semakin gesit akan saya bahas di lain waktu. Udah sore nih hehhe, See ya!!

Leave a Reply

Your email address will not be published. Required fields are marked *