Did you ever see a suggestion such as “add expired headers?” If you have, you are not the only one. This is one of the most common website optimization advice you will hear when optimizing your site.
You’re likely always on the lookout for ways to speed up your WordPress site. One option is to add expired headers.
Expires headers tell web browsers if to load images from your server or the browser cache. These headers can make your website more responsive. Either manually add expired headers or use a plugin.
This article will discuss expired headers and their impact on your site. We’ll also show you how to add expired headers to WordPress.
What Are Expired Headers?
Read Also: How To Be Yourself On YouTube
Imagine if those files were saved on your browser yesterday when you requested them. These files will be loaded quickly from your browser, rather than the web server when you request them today. This reduces resource consumption and increases page loading time.
This would be much faster than caching, which accomplishes this.
The expired header is here to help. These rules are instructions that tell the browser to delete cached files and retrieve new ones.
To add expired headers for WordPress, you can either use a plugin to do this or modify your server files. Because you can make a mistake while editing your server files, it could cause your site to be broken. The latter is for more advanced users. A plugin is better if you don’t have much technical knowledge.
Use A WordPress Plugin
The WordPress plugin can be used to enable expired headers for your website. There are many plugins available, but caching plugins are the best. This plugin allows browser caching and expires headers in just a few mouse clicks. Let’s take a look at W3 Complete Cache.
First, activate the plugin by going to Plugins > New Section of your WordPress dashboard.
After activating the plugin, navigate Performance > browser cache. As shown below, in the General box, check the option Set expires headings.
Go to the CSS&JS section and select the box next to the Set expires heading. Next, enter your Expires header lifetime value in seconds. This number defaults to 31536000 seconds, or 365 days. This number can be modified as necessary.
For the HTML & XML, Media & Other Files sections, repeat the previous step. After you are done, click on Save All Settings.
How To Add Expired Headers On An Apache Server
To add expired headers to your Apache web server site host, you can use the file .htaccess located in the root folder.
You can edit the .htaccess file using FTP or cPanel. To make it simple, we will use cPanel for the connection.
Log in to your cPanel first. After the connection has been established, navigate to and click on the folder.
After you have entered the folder, search for the .htaccess file. If it is still not there, set the Hidden Files option to Show.
To add expired headers, simply add the following code to your
How To Add Expires Headers On A Nginx Server
NGINX is different from the Apache web server. This is why the .htaccess file will not be found. How do you add expired headers to NGINX?
Editing the configuration file of your server is required. This file can be accessed and edited in different ways depending on the host. For any assistance, you can always contact your host’s support team.
Next, add this code snippet to your server block.
You can change the expiration time for different file types as you wish. Save your configuration file after you have made the changes and restart Nginx.
Website loading speed is clearly improved by using expired headers. Although it won’t dramatically improve site speed, this strategy will undoubtedly enhance the user experience.
To manage the file types that are stored and delivered to your visitors, you can use expired headers. They are able to speed up the loading times of regular visitors and ensure that they only see fresh content. They are essential for website performance and user satisfaction.
It is important to know how to properly implement expired headers. If you don’t do it correctly, it will slow down your website. This is especially true for dynamic sites such as eCommerce websites.
If you enjoy this post kindly forward it to others too.