To increase your page speed, you should try your best to avoid or minimize redirects on your website. If a mobile user goes to example.com and it redirects them to www.example.com then redirects them to m.example.com, the user will experience slow page loads. Having a landing page that redirects multiple times to the final landing page will slow your page speed. Instead, you can design your website so that example.com uses a responsive design with different break points for desktops, tablets and mobile devices.
To increase your page speed, you should enable some sort of compression for your website. Most modern browsers support gzip compression. Enabling compression will reduce the size transferred response by up to 90%, reduce the client’s data usage and improve the time to render your pages.
It is recommended to enable text compression with GZIP on your web server.
There are many potential factors that may slow down the response time of your server. Some causes could be slow application logic, slow database queries, slow routing, frameworks, libraries, resource CPU starvation or memory starvation.
If you believe your slow response time is due to CPU or memory, you may think about upgrading your web server. It is important to reduce your server response time to less than 200ms.
Fetching resources between the client and server can be very slow and expensive for the visitor. To increase your page speed, you should always consider using caching to help determine whether the browser can reuse a previously fetched resource.
Minifying resources is when you remove unnecessary or redundant data without affecting how the page is shown by the browser. For instance, you can create a header.php page and include it to all your pages instead of having duplicates of the header on every page. You can also remove comments in your code, remove unused code and use shorter variables and function names to improve your page speed.
Images usually account for the most bytes on a page. Therefore, it is very important for you to optimize your images. The less bytes the images are, the faster your pages will load up. Using the right image optimization is a process you need to take. Be careful when optimizing your images. If you optimize the images too much, the quality of the images may be poor. Also be on the lookout for images that you can replace with CSS effects or web fonts. Any image that you can eliminate or replace with web fonts or CSS effects will help with your page speed.
Browsers will block rendering a page until all external style sheets are downloaded and processed. It is vital to optimize your CSS delivery so that your page can load faster. You can do so by inlining small CSS files directly into your HTML document. Do not inline large data URIs or CSS attributes.
To increase your page speed, try to reduce the size of the above-the-fold content. The above-the-fold content is implying the upper half of the front page of your website that doesn’t require you to scroll down the page to see. Many websites that seem very fast are often just as large as slow websites. They just prioritize the above the fold content so that the site appears to load fast. Users love webpages that show up quickly and this is why you should prioritize visible content on your pages. Always load the above the fold content first. The footer is at the bottom of the page for a reason so it doesn’t make any sense to add many external files or images to your footer. The user will rarely see your footer. Structure your HTML so that it loads the critical above-the-fold content first and reduce the amount of data used by your resources.
By making sure you are using the asynchronous version of your scripts, your page speed and improve greatly. Many scripts such as Twitter, Facebook, Disqus and Google Analytics are async by default. For those that are not async by default, you should make an effort to see if they have an async version of their script.