How to Add Expires Headers in WordPress

What is Expires Headers

Expires headers are a type of HTTP header that indicates how long until cached copies of site resources expire. Expires headers tell the browsers what resource can be stored and fetched from the browser’s cache or the source itself. Using the expires headers, you maximize the speed of your site by reducing the HTTP requests between your device and the Service and also help you load the site more easily.

Caching

Browser caching enables the browser to cache to locally store resources improving site speed. This tells the web browser how long it should store your website resources before they are deleted.

How to enable Expires header in wordpress using .htaccess

Find your .htaccess file. Download a backup copy of the .htaccess file to your local computer. Add the following code snippet in the file

How to enable Expires header in Nginx

Nginx works in a different way to Apache in that it does not make use of a specific file like Apache does with the .htaccess file. Instead, you need to edit the server configuration file then copy and paste the following line of code to your server block.

You can adjust the expiration times for different types of files as needed.

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *