Increase WordPress website speed without plugin
I managed to increase the speed of my WordPress websites more than 3x without any plugins. Putting another layer of complexity (plugin) will never help you to increase the speed of your WordPress website.
Page speed is crucial for SEO so you better master it.
Let’s dive deep into this list of four “free” improvements that everybody, and their dogs, can do right now.
What I have learned from experience and through hours of research is explained here. To speed up your WordPress without plugins you have to implement these four simple steps:
- Update to the latest version of PHP
- Enable HTTP/2 protocol
- Compress files – Gzip
- HTTP Cache policy
Every time when I was trying to optimize websites for my clients to load faster I was doing the whole bunch of asset optimizations. Also, somebody told me to try this plugin or another one…
In most of the cases, it was even worse.
After years of experience and many sleepless nights, I came to the point of my career where all these problems are funny and solutions are obvious.
If you’re not able to implement these four things by yourself maybe you should consider employing Full Stack developer.
Update to the latest version of PHP – faster than ever
There is not one reason why not to upgrade PHP to 7.4 if you are running a WordPress website. According to the first reactions on twitter, PHP 7.4 can speed up your website up to 10x.
As the next step requires PHP-FPM, I would like to recommend you install
php7.4-fpm first and then move to the next step.
sudo apt-get install php7.4-fpm
sudo a2enmod proxy_fcgi
sudo a2enconf php7.4-fpm
sudo a2dismod php7.4
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
sudo service apache2 restart
Enable HTTP/2 protocol
This is an easy one but very very beneficial. HTTP/2 is the second generation of the HTTP protocol.
If you are running your website on Apache webserver you have to do a few configuration steps:
Enable the module mod_http2
sudo a2enmod http2
sudo service apache2 restart
Enable the HTTP/2 protocol by adding the following to/etc/apache2/apache2.conf:
Protocols h2 http/1.1
If you want to see which websites are using HTTP2 you can install Google Chrome Extension I recommend in this article.
Compress files – Gzip (to improve loading speed)
Gzip is a method of compressing files that allows your web server to provide smaller file sizes that load faster for your website users.
Please make sure you have
mod_deflate installed and enabled on the server.
sudo a2enmod deflate
In your .htaccess add this:
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
HTTP Cache policy
Once when a visitor of your website loads the page, you want to cache all static assets in visitor’s browser cache then. Fortunately, Apache expires module allows us to specify expiring time for all content type separately by adding this in
ExpiresDefault "access plus 30 seconds"
ExpiresByType text/html "access plus 15 days"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType text/js "access plus 1 months"
I hope this will help you to achieve 100/100 on PageSpeed test 😉 Don’t forget to come back after you implement it to thank me 😛
BTW. I recommend you to use some of the Chrome Extensions I use to improve my workflow. If you are Full Stack developer and you want to move to Berlin I research the salary range for this position.