Load time optimization for WordPress

26.04.2019 - David Bongard in Search Engine Optimization

Presentation and further links for the lecture on April 27, 2019, at WordCamp Vienna.

The lecture provides a brief introduction to the fundamentals of load time optimization, which is also understandable for beginners. In the second half, practical solutions for WordPress are presented that are easily applicable for advanced users and developers.

The presentation

Links to analysis tools

These provide metrics and insights for PageSpeed and load time optimization.

WordPress plugins for load time optimization

Information on usage can be found in the presentation.

WordPress caching plugins

A must for every WordPress website:

Load time optimization via .htaccess

On the server side, you can improve your website’s load time by using the following directives in your .htaccess file. You can find more details about this optimization method here: https://technumero.com/increase-page-speed-using-htaccess-wordpress/

# START GZIP COMPRESSION

mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

# END GZIP COMPRESSION

# START DEFLATE COMPRESSION

AddOutputFilterByType DEFLATE "application/atom+xml" 
"application/javascript" 
"application/json" 
"application/ld+json" 
"application/manifest+json" 
"application/rdf+xml" 
"application/rss+xml" 
"application/schema+json" 
"application/vnd.geo+json" 
"application/vnd.ms-fontobject" 
"application/x-font" 
"application/x-font-opentype" 
"application/x-font-otf" 
"application/x-font-truetype" 
"application/x-font-ttf" 
"application/x-javascript" 
"application/x-web-app-manifest+json" 
"application/xhtml+xml" 
"application/xml" 
"font/eot" 
"font/otf" 
"font/ttf" 
"font/opentype" 
"image/bmp" 
"image/svg+xml" 
"image/vnd.microsoft.icon" 
"image/x-icon" 
"text/cache-manifest" 
"text/css" 
"text/html" 
"text/javascript" 
"text/plain" 
"text/vcard" 
"text/vnd.rim.location.xloc" 
"text/vtt" 
"text/x-component" 
"text/x-cross-domain-policy" 
"text/xml"

# END DEFLATE COMPRESSION

# START ENABLE KEEP ALIVE

Header set Connection keep-alive

# END ENABLE KEEP ALIVE

# START EXPIRES CACHING

ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"

# END EXPIRES CACHING

# BEGIN Cache-Control Headers

<filesmatch ".(ico|jpe?g|png|gif|swf)$"="">
Header set Cache-Control "public"

<filesmatch ".(css)$"="">
Header set Cache-Control "public"

<filesmatch ".(js)$"="">
Header set Cache-Control "private"

<filesmatch ".(x?html?|php)$"="">
Header set Cache-Control "private, must-revalidate"

# END Cache-Control Headers

# ENABLE LITESPEED CACHE START

CacheEnable public
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^GET|HEAD$
RewriteCond %{HTTP_HOST} ^sample.com|sample.net|sample.org [NC]
RewriteCond %{REQUEST_URI} !login|admin|register|post|cron
RewriteCond %{QUERY_STRING} !nocache
RewriteRule .* - [E=Cache-Control:max-age=300]

# ENABLE LITESPEED CACHE END

# START Disable server signature #
ServerSignature Off
# END Disable server signature #

Need assistance with load time optimization? As a specialized WordPress agency in Vienna, we are happy to help you!

About the author - David Bongard

David Bongard has been building websites since 1998 – first as a web developer, and since 2014 as managing director and CTO of Resonanz Digital in Vienna. Together with his team, he develops custom web applications and e-commerce solutions for companies with demanding digital requirements – from concept and implementation through to ongoing support in live operation.