Categories
Uncategorized

Optimize your website in 5 minutes

Getting a good score in Google Pagespeed Insights is very important, as it is a main factor for good User Experience (UX).

Minify Js, HTML & CSS

Minifying the Javascript, HTML and CSS helps reduce the page load times drastically.

Optimize Images

Optimize your images before hosting them online and using them on your site. You can optimize images online for free here.

Reduce Server Response Time

According to Google, the ideal server response time is less than 200 milli seconds.

  • Minimize plugins by removing unused plugins
  • Try to minimize the use of WordPress plugins that serve more than one purpose, like Yoast SEO which takes care of your SEO and also manages your sitemap.xml
  • Make sure that backup and caching is all performed on server side, instead of plugins.
  • Ensure that you have enough server capacity to balance your traffic.
  • Try to use server config files (Apache -> /etc/apache/apache.conf, Apache2 -> /etc/apache2/apache2.conf, nginx -> /etc/nginx/nginx.conf) for configuration rather than .htaccess files. The performance gain is negligible though.
  • Using HTTP 2 over 1. (You need an SSL certificate for this as HTTP 2 is dependent on HTTPS)
  • Use the Autoptimizeplugin to serve cached static Js and CSS content bundled into a single file.

Leverage Browser Caching

If you haven’t enabled the headers module in Apache, then enable them by running the following.

If you haven’t enabled the ExpiresDefault in your Apache. If you are using Ubunutu 14, it is a straight forward fix. You need to run the following line as root.
ln -s /etc/apache2/mods-available/expires.load /etc/apache2/mods-enabled/
You will need to add the following code to your server config file if using Apache. This code tells the browser for how long what filetypes are good, so that it doesn’t have to fetch them from the server everytime.

Now restart the service (sudo service apache2 restart)

Enable Compression

Add the following code to your config file for Apache to enable compression of the following file types.

Avoid landing page redirects

Make sure that your homepage doesn’t have any redirects.

If you are using Google Adsense and Google Analytics or some external scripts like me, then it is up to you to decide whether to host these script files on your server or not.