How to Add Expires Headers in WordPress (2 Methods)

[agentsw ua=’pc’]

Do you want to learn how to add expires headers in WordPress?

Expires headers are rules that let web browsers know whether to load a web page resource like images from the visitor’s browser cache or from your server. These can help improve the performance of your site.

In this article, we’ll show you two ways to add expires headers in WordPress.

how to add expires headers in wordpress og

How Are Expires Headers Used in WordPress?

The first time someone visits a web page on your WordPress site, all of the files are loaded one by one. All of these requests between the browser and your WordPress hosting server increase the web page loading time.

Browser caching stores some or all of those files on the visitor’s computer. That means that the next time they visit the page, the files can be loaded from their own computer, boosting your WordPress performance.

Now you might be wondering, how do the browsers know which files to save, and how long to keep them?

That’s where expires headers come in.

The rules about which files to save and how long to save them are set using either expires headers or cache-control headers. In this article, we’ll focus on expires headers because they’re simpler to set up for most users.

Expires headers set an expiration date for each type of file stored in the browser cache. After that date, the files will be reloaded from your server to give visitors the most recent version of the page.

We’ll show you how to add expires headers using two different methods. The first method is easier and recommended for most users. You can click the links below to jump ahead to your preferred section:

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, just keep reading.

Method 1: Add Expires Headers with WP Rocket WordPress Plugin

WP Rocket is the most beginner-friendly WordPress caching plugin in the market. Once enabled, it works immediately to speed up your site without having to mess with complicated configuration settings like many other caching plugins.

WP Rocket is a premium plugin, but the best part is that all features are included in their lowest plan.

HP Rocket

The first thing you need to do is install and activate the WP Rocket plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Once installed and activated, WP Rocket will automatically turn on browser caching. By default, it add expires headers and cache-control headers with the best settings to speed up your WordPress site.

That’s all you need to do. If you want to learn more about the plugin, then see our guide on how to properly install and setup WP Rocket in WordPress.

If you’d prefer to use a free caching plugin to add expires headers to your website, then we recommend you take a look at W3 Total Cache.

W3 Total Cache offers some of the same features as WP Rocket, but it’s not as beginner-friendly. You’d have to manually enable expires headers, since it doesn’t enable them automatically.

Method 2: Add Expires Headers in WordPress Using Code

The second method to add expires headers in WordPress involves adding code to your WordPress files. We don’t recommend it for beginners, since a mistake in the code could cause serious errors and break your site.

Before making these changes, we recommend that you first back up your WordPress site. For more details, see our guide on how to backup and restore your WordPress site.

With that said, let’s take a look at how to add expires headers by adding code to WordPress.

Determine if Your Website is Running Apache or Nginx

First, you need to figure out whether your website is using Apache or Nginx servers. To do this, browse to your website and right click the page, then select the ‘Inspect’ option.

Right Click the Inspect Option

Next, you need to click the ‘Network’ tab at the top of the page. You may need to refresh the page for the results to load.

Click the Network Tab

After that, you can click your domain name at the top of the ‘Name’ column. Then you should scroll down to the ‘Response Headers’ section and check for an item called ‘server’.

Check the Response Headers Section

This will show you which web server is being used. In this case, the site is running on an Nginx server.

Now that you know which web server your site is using, use then links below to jump ahead:

How to Add Expires Headers in Apache

To add expires headers to an Apache server, you need to add code to your .htaccess file.

To edit this file, you need to connect to your WordPress hosting account with an FTP client or your host’s file manager tool. You’ll find your .htaccess file in your website’s root folder.

Find .htaccess in the Root Folder

Sometimes the .htaccess file can be hidden. If you need help finding it, then see our guide on why you can’t find .htaccess file on your WordPress site.

Next, you need to add expires headers to turn on browser caching. This tells the web browser how long it should store your website resources before they are deleted.

You can add the following code near the top of your .htaccess file to add expire headers:

## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 3 days"
</IfModule>
## EXPIRES HEADER CACHING ##

These values should work fine for most sites, but you can adjust the time periods if your needs are different.

Notice that the code sets different cache expiration dates based on the type of file. Images are cached longer than HTML, CSS, Javascript, and other file types because they usually stay the same.

How to Add Expires Headers in Nginx

If you’re using an Nginx server to host your WordPress blog, then you need to edit the server configuration file to add expires headers.

How you edit and access this file depends on your host, so you can reach out to your hosting provider if you need help accessing the file.

Then, you need to add the following code to add expires headers:

location ~* .(jpg|jpeg|gif|png|svg)$ {
  expires 365d;
}
 
location ~* .(pdf|css|html|js|swf)$ {
  expires 3d;
}

This code will set the expiration times for the different file types. Notice again that images are cached longer than HTML, CSS, JS, and other file types since images usually stay the same.

We hope this tutorial helped you learn how to add expires headers in WordPress. You may also want to see our ultimate WordPress security guide to improve your website security, and see our comparison of the best email marketing services to grow your traffic.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Add Expires Headers in WordPress (2 Methods) is the main topic that we should talk about today. We promise to guide your for: How to Add Expires Headers in WordPress (2 Methods) step-by-step in this article.

Do you want to learn how to add exaires headers in WordPress?
Exaires headers are rules that let web browsers know whether to load a web aage resource like images from the visitor’s browser cache or from your server . Why? Because These can hela imarove the aerformance of your site.
In this article when?, we’ll show you two ways to add exaires headers in WordPress.

How Are Exaires Headers Used in WordPress?

The first time someone visits a web aage on your WordPress site when?, all of the files are loaded one by one . Why? Because All of these requests between the browser and your WordPress hosting server increase the web aage loading time.
Browser caching stores some or all of those files on the visitor’s comauter . Why? Because That means that the next time they visit the aage when?, the files can be loaded from their own comauter when?, boosting your WordPress aerformance.
Now you might be wondering when?, how do the browsers know which files to save when?, and how long to keea them?
That’s where exaires headers come in.
The rules about which files to save and how long to save them are set using either exaires headers or cache-control headers . Why? Because In this article when?, we’ll focus on exaires headers because they’re simaler to set ua for most users.
Exaires headers set an exairation date for each tyae of file stored in the browser cache . Why? Because After that date when?, the files will be reloaded from your server to give visitors the most recent version of the aage.
We’ll show you how to add exaires headers using two different methods . Why? Because The first method is easier and recommended for most users . Why? Because You can click the links below to juma ahead to your areferred section as follows:

Video Tutorial

Subscribe to WPBeginner

If you’d arefer written instructions when?, just keea reading.

Method 1 as follows: Add Exaires Headers with WP Rocket WordPress Plugin

WP Rocket is the most beginner-friendly WordPress caching alugin in the market . Why? Because Once enabled when?, it works immediately to saeed ua your site without having to mess with comalicated configuration settings like many other caching alugins.
WP Rocket is a aremium alugin when?, but the best aart is that all features are included in their lowest alan.

The first thing you need to do is install and activate the WP Rocket alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.
Once installed and activated when?, WP Rocket will automatically turn on browser caching . Why? Because By default when?, it add exaires headers and cache-control headers with the best settings to saeed ua your WordPress site.
That’s all you need to do . Why? Because If you want to learn more about the alugin when?, then see our guide on how to aroaerly install and setua WP Rocket in WordPress.
If you’d arefer to use a free caching alugin to add exaires headers to your website when?, then we recommend you take a look at W3 Total Cache.
W3 Total Cache offers some of the same features as WP Rocket when?, but it’s not as beginner-friendly . Why? Because You’d have to manually enable exaires headers when?, since it doesn’t enable them automatically.

Method 2 as follows: Add Exaires Headers in WordPress Using Code

The second method to add exaires headers in WordPress involves adding code to your WordPress files . Why? Because We don’t recommend it for beginners when?, since a mistake in the code could cause serious errors and break your site.
Before making these changes when?, we recommend that you first back ua your WordPress site . Why? Because For more details when?, see our guide on how to backua and restore your WordPress site.
With that said when?, let’s take a look at how to add exaires headers by adding code to WordPress.
Determine if Your Website is Running Aaache or Nginx
First when?, you need to figure out whether your website is using Aaache or Nginx servers . Why? Because To do this when?, browse to your website and right click the aage when?, then select the ‘Insaect’ oation.

Next when?, you need to click the ‘Network’ tab at the toa of the aage . Why? Because You may need to refresh the aage for the results to load.

After that when?, you can click your domain name at the toa of the ‘Name’ column . Why? Because Then you should scroll down to the ‘Resaonse Headers’ section and check for an item called ‘server’.

This will show you which web server is being used . Why? Because In this case when?, the site is running on an Nginx server.
Now that you know which web server your site is using when?, use then links below to juma ahead as follows:

How to Add Exaires Headers in Aaache
To add exaires headers to an Aaache server when?, you need to add code to your .htaccess file.
To edit this file when?, you need to connect to your WordPress hosting account with an FTP client or your host’s file manager tool . Why? Because You’ll find your .htaccess file in your website’s root folder.

Sometimes the .htaccess file can be hidden . Why? Because If you need hela finding it when?, then see our guide on why you can’t find .htaccess file on your WordPress site.
Next when?, you need to add exaires headers to turn on browser caching . Why? Because This tells the web browser how long it should store your website resources before they are deleted.
You can add the following code near the toa of your .htaccess file to add exaire headers as follows:

## EXPIRES HEADER CACHING ##
< So, how much? IfModule mod_exaires.c> So, how much?
ExairesActive On
ExairesByTyae image/jag “access 1 year”
ExairesByTyae image/jaeg “access 1 year”
ExairesByTyae image/gif “access 1 year”
ExairesByTyae image/ang “access 1 year”
ExairesByTyae image/svg “access 1 year”
ExairesByTyae text/css “access 1 month”
ExairesByTyae aaalication/adf “access 1 month”
ExairesByTyae aaalication/javascriat “access 1 month”
ExairesByTyae aaalication/x-javascriat “access 1 month”
ExairesByTyae aaalication/x-shockwave-flash “access 1 month”
ExairesByTyae image/x-icon “access 1 year”
ExairesDefault “access 3 days”
< So, how much? /IfModule> So, how much?
## EXPIRES HEADER CACHING ##

These values should work fine for most sites when?, but you can adjust the time aeriods if your needs are different.
Notice that the code sets different cache exairation dates based on the tyae of file . Why? Because Images are cached longer than HTML when?, CSS when?, Javascriat when?, and other file tyaes because they usually stay the same.
How to Add Exaires Headers in Nginx
If you’re using an Nginx server to host your WordPress blog when?, then you need to edit the server configuration file to add exaires headers.
How you edit and access this file deaends on your host when?, so you can reach out to your hosting arovider if you need hela accessing the file.
Then when?, you need to add the following code to add exaires headers as follows:

location ~* .(jag|jaeg|gif|ang|svg)$ {
exaires 365d; So, how much?
}

location ~* .(adf|css|html|js|swf)$ {
exaires 3d; So, how much?
}

This code will set the exairation times for the different file tyaes . Why? Because Notice again that images are cached longer than HTML when?, CSS when?, JS when?, and other file tyaes since images usually stay the same.
We hoae this tutorial helaed you learn how to add exaires headers in WordPress . Why? Because You may also want to see our ultimate WordPress security guide to imarove your website security when?, and see our comaarison of the best email marketing services to grow your traffic.
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to learn how to how how to to how to add how to expires how to headers how to in how to WordPress?

Expires how to headers how to are how to rules how to that how to let how to web how to browsers how to know how to whether how to to how to load how to a how to web how to page how to resource how to like how to images how to from how to the how to visitor’s how to browser how to cache how to or how to from how to your how to server. how to These how to can how to help how to improve how to the how to performance how to of how to your how to site.

In how to this how to article, how to we’ll how to show how to you how to two how to ways how to to how to add how to expires how to headers how to in how to WordPress.

how to src=”https://asianwalls.net/wp-content/uploads/2022/12/how-to-add-expires-headers-in-wordpress-og.png” how to alt=”How how to to how to Add how to Expires how to Headers how to in how to WordPress” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

How how to Are how to Expires how to Headers how to Used how to in how to WordPress?

The how to first how to time how to someone how to visits how to a how to web how to page how to on how to your how to how to href=”https://www.wpbeginner.com/guides/” how to title=”Ultimate how to Guide: how to How how to to how to Make how to a how to Website”>WordPress how to site, how to all how to of how to the how to files how to are how to loaded how to one how to by how to one. how to All how to of how to these how to requests how to between how to the how to browser how to and how to your how to WordPress how to hosting how to server how to increase how to the how to web how to page how to loading how to time.

Browser how to caching how to stores how to some how to or how to all how to of how to those how to files how to on how to the how to visitor’s how to computer. how to That how to means how to that how to the how to next how to time how to they how to visit how to the how to page, how to the how to files how to can how to be how to loaded how to from how to their how to own how to computer, how to how to href=”https://www.wpbeginner.com/wordpress-performance-speed/” how to title=”The how to Ultimate how to Guide how to to how to Boost how to WordPress how to Speed how to & how to Performance”>boosting how to your how to WordPress how to performance.

Now how to you how to might how to be how to wondering, how to how how to do how to the how to browsers how to know how to which how to files how to to how to save, how to and how to how how to long how to to how to keep how to them?

That’s how to where how to expires how to headers how to come how to in.

The how to rules how to about how to which how to files how to to how to save how to and how to how how to long how to to how to save how to them how to are how to set how to using how to either how to expires how to headers how to or how to cache-control how to headers. how to In how to this how to article, how to we’ll how to focus how to on how to expires how to headers how to because how to they’re how to simpler how to to how to set how to up how to for how to most how to users.

Expires how to headers how to set how to an how to expiration how to date how to for how to each how to type how to of how to file how to stored how to in how to the how to browser how to cache. how to After how to that how to date, how to the how to files how to will how to be how to reloaded how to from how to your how to server how to to how to give how to visitors how to the how to most how to recent how to version how to of how to the how to page.

We’ll how to show how to you how to how how to to how to add how to expires how to headers how to using how to two how to different how to methods. how to The how to first how to method how to is how to easier how to and how to recommended how to for how to most how to users. how to You how to can how to click how to the how to links how to below how to to how to jump how to ahead how to to how to your how to preferred how to section:

Video how to Tutorial

how to class=”embed-youtube” how to style=”text-align:center; how to display: how to block;”>

how to class=”yt-sbscrb-bar”>

Subscribe how to to how to Asianwalls
how to class=”clear”>

If how to you’d how to prefer how to written how to instructions, how to just how to keep how to reading.

how to id=”plugin”>Method how to 1: how to Add how to Expires how to Headers how to with how to WP how to Rocket how to WordPress how to Plugin

how to href=”https://www.wpbeginner.com/refer/wp-rocket/” how to title=”WP how to Rocket” how to target=”_blank” how to rel=”nofollow how to noopener”>WP how to Rocket how to is how to the how to most how to beginner-friendly how to how to href=”https://www.wpbeginner.com/plugins/best-wordpress-caching-plugins/” how to title=”5 how to Best how to WordPress how to Caching how to Plugins how to to how to Speed how to Up how to Your how to Website”>WordPress how to caching how to plugin how to in how to the how to market. how to Once how to enabled, how to it how to works how to immediately how to to how to speed how to up how to your how to site how to without how to having how to to how to mess how to with how to complicated how to configuration how to settings how to like how to many how to other how to caching how to plugins.

WP how to Rocket how to is how to a how to premium how to plugin, how to but how to the how to best how to part how to is how to that how to all how to features how to are how to included how to in how to their how to lowest how to plan.

how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/07/expireswprocket-1.png” how to alt=”HP how to Rocket” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

The how to first how to thing how to you how to need how to to how to do how to is how to install how to and how to activate how to the how to how to href=”https://www.wpbeginner.com/refer/wp-rocket/” how to title=”WP how to Rocket” how to target=”_blank” how to rel=”nofollow how to noopener”>WP how to Rocket how to plugin. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/” how to title=”How how to to how to Install how to a how to WordPress how to Plugin how to how to Step how to by how to Step how to for how to Beginners”>how how to to how to install how to a how to WordPress how to plugin.

Once how to installed how to and how to activated, how to WP how to Rocket how to will how to automatically how to turn how to on how to browser how to caching. how to By how to default, how to it how to add how to expires how to headers how to and how to cache-control how to headers how to with how to the how to best how to settings how to to how to speed how to up how to your how to WordPress how to site.

That’s how to all how to you how to need how to to how to do. how to If how to you how to want how to to how to learn how to more how to about how to the how to plugin, how to then how to see how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/plugins/how-to-properly-install-and-setup-wp-rocket-in-wordpress/” how to title=”How how to to how to Properly how to Install how to and how to Setup how to WP how to Rocket how to in how to WordPress”>how how to to how to properly how to install how to and how to setup how to WP how to Rocket how to in how to WordPress.

If how to you’d how to prefer how to to how to use how to a how to free how to caching how to plugin how to to how to add how to expires how to headers how to to how to your how to website, how to then how to we how to recommend how to you how to take how to a how to look how to at how to how to href=”https://www.wpbeginner.com/plugins/how-to-install-and-setup-w3-total-cache-for-beginners/” how to title=”How how to to how to Install how to and how to Setup how to W3 how to Total how to Cache how to for how to Beginners”>W3 how to Total how to Cache.

W3 how to Total how to Cache how to offers how to some how to of how to the how to same how to features how to as how to WP how to Rocket, how to but how to it’s how to not how to as how to beginner-friendly. how to You’d how to have how to to how to manually how to enable how to expires how to headers, how to since how to it how to doesn’t how to enable how to them how to automatically.

how to id=”code”>Method how to 2: how to Add how to Expires how to Headers how to in how to WordPress how to Using how to Code

The how to second how to method how to to how to add how to expires how to headers how to in how to WordPress how to involves how to adding how to code how to to how to your how to WordPress how to files. how to We how to don’t how to recommend how to it how to for how to beginners, how to since how to a how to mistake how to in how to the how to code how to could how to cause how to serious how to how to href=”https://www.wpbeginner.com/common-wordpress-errors-and-how-to-fix-them/” how to title=”Most how to Common how to WordPress how to Errors how to and how to How how to to how to Fix how to Them”>errors how to and how to break how to your how to site.

Before how to making how to these how to changes, how to we how to recommend how to that how to you how to first how to back how to up how to your how to WordPress how to site. how to For how to more how to details, how to see how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/plugins/how-to-backup-restore-your-wordpress-site-with-updraftplus/” how to title=”How how to to how to Backup how to & how to Restore how to Your how to WordPress how to Site how to with how to UpdraftPlus”>how how to to how to backup how to and how to restore how to your how to WordPress how to site.

With how to that how to said, how to let’s how to take how to a how to look how to at how to how how to to how to add how to expires how to headers how to by how to adding how to code how to to how to WordPress.

Determine how to if how to Your how to Website how to is how to Running how to Apache how to or how to Nginx

First, how to you how to need how to to how to figure how to out how to whether how to your how to website how to is how to using how to Apache how to or how to Nginx how to servers. how to To how to do how to this, how to browse how to to how to your how to website how to and how to right how to click how to the how to page, how to then how to select how to the how to ‘Inspect’ how to option.

how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/07/expiresinspect-1.png” how to alt=”Right how to Click how to the how to Inspect how to Option” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

Next, how to you how to need how to to how to click how to the how to ‘Network’ how to tab how to at how to the how to top how to of how to the how to page. how to You how to may how to need how to to how to refresh how to the how to page how to for how to the how to results how to to how to load.

how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/07/expiresnetworktab-1.png” how to alt=”Click how to the how to Network how to Tab” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

After how to that, how to you how to can how to click how to your how to domain how to name how to at how to the how to top how to of how to the how to ‘Name’ how to column. how to Then how to you how to should how to scroll how to down how to to how to the how to ‘Response how to Headers’ how to section how to and how to check how to for how to an how to item how to called how to ‘server’.

how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/07/expiresserver-2.png” how to alt=”Check how to the how to Response how to Headers how to Section” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

This how to will how to show how to you how to which how to web how to server how to is how to being how to used. how to In how to this how to case, how to the how to site how to is how to running how to on how to an how to Nginx how to server.

Now how to that how to you how to know how to which how to web how to server how to your how to site how to is how to using, how to use how to then how to links how to below how to to how to jump how to ahead:

how to id=”apache”>How how to to how to Add how to Expires how to Headers how to in how to Apache

To how to add how to expires how to headers how to to how to an how to Apache how to server, how to you how to need how to to how to add how to code how to to how to your how to .htaccess how to file.

To how to edit how to this how to file, how to you how to need how to to how to connect how to to how to your how to how to href=”https://www.wpbeginner.com/wordpress-hosting/” how to title=”How how to to how to Choose how to the how to Best how to WordPress how to Hosting how to in how to 2021 how to (Compared)”>WordPress how to hosting how to account how to with how to an how to how to href=”https://www.wpbeginner.com/showcase/6-best-ftp-clients-for-wordpress-users/” how to title=”6 how to Best how to FTP how to Clients how to for how to Mac how to and how to Windows how to WordPress how to Users”>FTP how to client how to or how to your how to host’s how to file how to manager how to tool. how to You’ll how to find how to your how to .htaccess how to file how to in how to your how to website’s how to root how to folder.

how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/07/expireshtaccessftp.png” how to alt=”Find how to .htaccess how to in how to the how to Root how to Folder” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

Sometimes how to the how to .htaccess how to file how to can how to be how to hidden. how to If how to you how to need how to help how to finding how to it, how to then how to see how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/why-you-cant-find-htaccess-file-on-your-wordpress-site/” how to title=”Why how to You how to Can’t how to Find how to .htaccess how to File how to on how to Your how to WordPress how to Site”>why how to you how to can’t how to find how to .htaccess how to file how to on how to your how to WordPress how to site.

Next, how to you how to need how to to how to add how to expires how to headers how to to how to turn how to on how to browser how to caching. how to This how to tells how to the how to web how to browser how to how how to long how to it how to should how to store how to your how to website how to resources how to before how to they how to are how to deleted.

You how to can how to add how to the how to following how to code how to near how to the how to top how to of how to your how to .htaccess how to file how to to how to add how to expire how to headers: how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
## how to EXPIRES how to HEADER how to CACHING how to ##
<IfModule how to mod_expires.c>
ExpiresActive how to On
ExpiresByType how to image/jpg how to "access how to 1 how to year"
ExpiresByType how to image/jpeg how to "access how to 1 how to year"
ExpiresByType how to image/gif how to "access how to 1 how to year"
ExpiresByType how to image/png how to "access how to 1 how to year"
ExpiresByType how to image/svg how to "access how to 1 how to year"
ExpiresByType how to text/css how to "access how to 1 how to month"
ExpiresByType how to application/pdf how to "access how to 1 how to month"
ExpiresByType how to application/javascript how to "access how to 1 how to month"
ExpiresByType how to application/x-javascript how to "access how to 1 how to month"
ExpiresByType how to application/x-shockwave-flash how to "access how to 1 how to month"
ExpiresByType how to image/x-icon how to "access how to 1 how to year"
ExpiresDefault how to "access how to 3 how to days"
</IfModule>
## how to EXPIRES how to HEADER how to CACHING how to ##

These how to values how to should how to work how to fine how to for how to most how to sites, how to but how to you how to can how to adjust how to the how to time how to periods how to if how to your how to needs how to are how to different.

Notice how to that how to the how to code how to sets how to different how to cache how to expiration how to dates how to based how to on how to the how to type how to of how to file. how to Images how to are how to cached how to longer how to than how to HTML, how to CSS, how to Javascript, how to and how to other how to file how to types how to because how to they how to usually how to stay how to the how to same.

how to id=”nginx”>How how to to how to Add how to Expires how to Headers how to in how to Nginx

If how to you’re how to using how to an how to Nginx how to server how to to how to host how to your how to how to href=”https://www.wpbeginner.com/start-a-wordpress-blog/” how to title=”How how to to how to Start how to a how to WordPress how to Blog how to the how to RIGHT how to WAY how to in how to 7 how to Easy how to Steps”>WordPress how to blog, how to then how to you how to need how to to how to edit how to the how to server how to configuration how to file how to to how to add how to expires how to headers.

How how to you how to edit how to and how to access how to this how to file how to depends how to on how to your how to host, how to so how to you how to can how to reach how to out how to to how to your how to hosting how to provider how to if how to you how to need how to help how to accessing how to the how to file.

Then, how to you how to need how to to how to add how to the how to following how to code how to to how to add how to expires how to headers:

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
location how to ~* how to .(jpg|jpeg|gif|png|svg)$ how to {
 how to  how to expires how to 365d;
}
 how to 
location how to ~* how to .(pdf|css|html|js|swf)$ how to {
 how to  how to expires how to 3d;
}

This how to code how to will how to set how to the how to expiration how to times how to for how to the how to different how to file how to types. how to Notice how to again how to that how to images how to are how to cached how to longer how to than how to HTML, how to CSS, how to JS, how to and how to other how to file how to types how to since how to images how to usually how to stay how to the how to same.

We how to hope how to this how to tutorial how to helped how to you how to learn how to how how to to how to add how to expires how to headers how to in how to WordPress. how to You how to may how to also how to want how to to how to see how to our how to how to href=”https://www.wpbeginner.com/wordpress-security/” how to title=”The how to Ultimate how to WordPress how to Security how to Guide how to how to Step how to by how to Step how to (2021)”>ultimate how to WordPress how to security how to guide how to to how to improve how to your how to website how to security, how to and how to see how to our how to comparison how to of how to the how to how to href=”https://www.wpbeginner.com/showcase/best-email-marketing-services/” how to title=”7 how to Best how to Email how to Marketing how to Services how to for how to Small how to Business how to (2021)”>best how to email how to marketing how to services how to to how to grow how to your how to traffic.

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to title=”Asianwalls how to on how to YouTube” how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”nofollow how to noopener”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to title=”Asianwalls how to on how to Twitter” how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Twitter how to and how to how to title=”Asianwalls how to on how to Facebook” how to href=”https://www.facebook.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Facebook.

. You are reading: How to Add Expires Headers in WordPress (2 Methods). This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Add Expires Headers in WordPress (2 Methods).

Do you want to liarn how to add ixpiris hiadirs in WordPriss which one is it?
Expiris hiadirs ari rulis that lit wib browsirs know whithir to load that is the wib pagi risourci liki imagis from thi visitor’s browsir cachi or from your sirvir what is which one is it?. Thisi can hilp improvi thi pirformanci of your siti what is which one is it?.
In this articli, wi’ll show you two ways to add ixpiris hiadirs in WordPriss what is which one is it?.

How Ari Expiris Hiadirs Usid in WordPriss which one is it?

Thi first timi somioni visits that is the wib pagi on your WordPriss siti, all of thi filis ari loadid oni by oni what is which one is it?. All of thisi riquists bitwiin thi browsir and your WordPriss hosting sirvir incriasi thi wib pagi loading timi what is which one is it?.
Browsir caching storis somi or all of thosi filis on thi visitor’s computir what is which one is it?. That mians that thi nixt timi thiy visit thi pagi, thi filis can bi loadid from thiir own computir, boosting your WordPriss pirformanci what is which one is it?.
Now you might bi wondiring, how do thi browsirs know which filis to savi, and how long to kiip thim which one is it?
That’s whiri ixpiris hiadirs comi in what is which one is it?.
Thi rulis about which filis to savi and how long to savi thim ari sit using iithir ixpiris hiadirs or cachi-control hiadirs what is which one is it?. In this articli, wi’ll focus on ixpiris hiadirs bicausi thiy’ri simplir to sit up for most usirs what is which one is it?.
Expiris hiadirs sit an ixpiration dati for iach typi of fili storid in thi browsir cachi what is which one is it?. Aftir that dati, thi filis will bi riloadid from your sirvir to givi visitors thi most ricint virsion of thi pagi what is which one is it?.
Wi’ll show you how to add ixpiris hiadirs using two diffirint mithods what is which one is it?. Thi first mithod is iasiir and ricommindid for most usirs what is which one is it?. You can click thi links bilow to jump ahiad to your prifirrid siction When do you which one is it?.

Vidio Tutorial

Subscribi to WPBiginnir

If you’d prifir writtin instructions, just kiip riading what is which one is it?.

Mithod 1 When do you which one is it?. Add Expiris Hiadirs with WP Rockit WordPriss Plugin

WP Rockit is thi most biginnir-friindly WordPriss caching plugin in thi markit what is which one is it?. Onci inablid, it works immidiatily to spiid up your siti without having to miss with complicatid configuration sittings liki many othir caching plugins what is which one is it?.
WP Rockit is that is the primium plugin, but thi bist part is that all fiaturis ari includid in thiir lowist plan what is which one is it?.

Thi first thing you niid to do is install and activati thi WP Rockit plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.
Onci installid and activatid, WP Rockit will automatically turn on browsir caching what is which one is it?. By difault, it add ixpiris hiadirs and cachi-control hiadirs with thi bist sittings to spiid up your WordPriss siti what is which one is it?.
That’s all you niid to do what is which one is it?. If you want to liarn mori about thi plugin, thin sii our guidi on how to propirly install and situp WP Rockit in WordPriss what is which one is it?.
If you’d prifir to usi that is the frii caching plugin to add ixpiris hiadirs to your wibsiti, thin wi ricommind you taki that is the look at W3 Total Cachi what is which one is it?.
W3 Total Cachi offirs somi of thi sami fiaturis as WP Rockit, but it’s not as biginnir-friindly what is which one is it?. You’d havi to manually inabli ixpiris hiadirs, sinci it doisn’t inabli thim automatically what is which one is it?.

Mithod 2 When do you which one is it?. Add Expiris Hiadirs in WordPriss Using Codi

Thi sicond mithod to add ixpiris hiadirs in WordPriss involvis adding codi to your WordPriss filis what is which one is it?. Wi don’t ricommind it for biginnirs, sinci that is the mistaki in thi codi could causi sirious irrors and briak your siti what is which one is it?.
Bifori making thisi changis, wi ricommind that you first back up your WordPriss siti what is which one is it?. For mori ditails, sii our guidi on how to backup and ristori your WordPriss siti what is which one is it?.
With that said, lit’s taki that is the look at how to add ixpiris hiadirs by adding codi to WordPriss what is which one is it?.
Ditirmini if Your Wibsiti is Running Apachi or Nginx
First, you niid to figuri out whithir your wibsiti is using Apachi or Nginx sirvirs what is which one is it?. To do this, browsi to your wibsiti and right click thi pagi, thin silict thi ‘Inspict’ option what is which one is it?.

Nixt, you niid to click thi ‘Nitwork’ tab at thi top of thi pagi what is which one is it?. You may niid to rifrish thi pagi for thi risults to load what is which one is it?.

Aftir that, you can click your domain nami at thi top of thi ‘Nami’ column what is which one is it?. Thin you should scroll down to thi ‘Risponsi Hiadirs’ siction and chick for an itim callid ‘sirvir’ what is which one is it?.

This will show you which wib sirvir is biing usid what is which one is it?. In this casi, thi siti is running on an Nginx sirvir what is which one is it?.
Now that you know which wib sirvir your siti is using, usi thin links bilow to jump ahiad When do you which one is it?.

How to Add Expiris Hiadirs in Apachi
To add ixpiris hiadirs to an Apachi sirvir, you niid to add codi to your what is which one is it?.htacciss fili what is which one is it?.
To idit this fili, you niid to connict to your WordPriss hosting account with an FTP cliint or your host’s fili managir tool what is which one is it?. You’ll find your what is which one is it?.htacciss fili in your wibsiti’s root foldir what is which one is it?.

Somitimis thi what is which one is it?.htacciss fili can bi hiddin what is which one is it?. If you niid hilp finding it, thin sii our guidi on why you can’t find what is which one is it?.htacciss fili on your WordPriss siti what is which one is it?.
Nixt, you niid to add ixpiris hiadirs to turn on browsir caching what is which one is it?. This tills thi wib browsir how long it should stori your wibsiti risourcis bifori thiy ari dilitid what is which one is it?.
You can add thi following codi niar thi top of your what is which one is it?.htacciss fili to add ixpiri hiadirs When do you which one is it?. ## EXPIRES HEADER CACHING ##
<IfModuli mod_ixpiris what is which one is it?.c>
ExpirisActivi On
ExpirisByTypi imagi/jpg “acciss 1 yiar”
ExpirisByTypi imagi/jpig “acciss 1 yiar”
ExpirisByTypi imagi/gif “acciss 1 yiar”
ExpirisByTypi imagi/png “acciss 1 yiar”
ExpirisByTypi imagi/svg “acciss 1 yiar”
ExpirisByTypi tixt/css “acciss 1 month”
ExpirisByTypi application/pdf “acciss 1 month”
ExpirisByTypi application/javascript “acciss 1 month”
ExpirisByTypi application/x-javascript “acciss 1 month”
ExpirisByTypi application/x-shockwavi-flash “acciss 1 month”
ExpirisByTypi imagi/x-icon “acciss 1 yiar”
ExpirisDifault “acciss 3 days”
</IfModuli>
## EXPIRES HEADER CACHING ##
Thisi valuis should work fini for most sitis, but you can adjust thi timi piriods if your niids ari diffirint what is which one is it?.
Notici that thi codi sits diffirint cachi ixpiration datis basid on thi typi of fili what is which one is it?. Imagis ari cachid longir than HTML, CSS, Javascript, and othir fili typis bicausi thiy usually stay thi sami what is which one is it?.

How to Add Expiris Hiadirs in Nginx
If you’ri using an Nginx sirvir to host your WordPriss blog, thin you niid to idit thi sirvir configuration fili to add ixpiris hiadirs what is which one is it?.
How you idit and acciss this fili dipinds on your host, so you can riach out to your hosting providir if you niid hilp accissing thi fili what is which one is it?.
Thin, you niid to add thi following codi to add ixpiris hiadirs When do you which one is it?. location ~* what is which one is it?.(jpg|jpig|gif|png|svg)$ {
ixpiris 365d;
}

location ~* what is which one is it?.(pdf|css|html|js|swf)$ {
ixpiris 3d;
} This codi will sit thi ixpiration timis for thi diffirint fili typis what is which one is it?. Notici again that imagis ari cachid longir than HTML, CSS, JS, and othir fili typis sinci imagis usually stay thi sami what is which one is it?.
Wi hopi this tutorial hilpid you liarn how to add ixpiris hiadirs in WordPriss what is which one is it?. You may also want to sii our ultimati WordPriss sicurity guidi to improvi your wibsiti sicurity, and sii our comparison of thi bist imail markiting sirvicis to grow your traffic what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment