Hey folks in this quick video we are going to look at a fast and slick trick
To having your website load as fast as possible for return visitors
It's easy to do it works like a charm
And should ultimately be a no-brainer if you're in the game of SEO optimization
and you want to improve user experience as much as you can
One general method to speed up page load times
is to reduce the number of HTTP requests required to pull your content from the server
and of course to reduce the amount of content or data that ends up going over the network.
And one great way to do this is to reduce the number of times a certain file is downloaded from the server
so that it can be rendered on the browser of your site's visitor
If they visit your site five times in one week
and the content on your site hasn't changed
then why have them download it all again and again and again
your 76 kilobyte index file
your hundred and twenty four kilobyte CSS
your JavaScript your images and so on
They're sucking 213 megabytes of content through dozens of HTTP requests
through their bandwidth when they first visit your site
And if they visit five times just to see the exact same content
Why choke up their network with over a thousand megabytes of content
when it's completely unnecessary.
Instead it's much much better to store some of that content on their local machine
the first time they visit then he first time they visit then load it backup from there whenever they visit the site again
less bandwidth over the network
less number of HTTP requests
and obviously it's going to take a lot less time
To render that content straight from their hard drive
instead of from the server
so the name of the game here
is leveraging local caching on your visitors machines.
Now obviously this won't apply to users who have their browsers
set to automatically clear their cache after every use
though there's not that many people out there that do that
or if a user wipes out their search history and clears the cache same thing
or if a user does a hard refresh on your webpage
then they'll be starting from scratch again
When they want to download your site's content
but for over 99.99% of the rest of the time
for most users around the world
they're going to be sitting there with an available cash to use
So one great way to reduce those HTTP requests
is to set expiration headers for content content.
Content that isn't going to be changing anytime soon
like maybe your images your JavaScript and your CSS
by adding these expiration headers
you're telling the users browser to go ahead and save that content on their local machine
until that expiration date
Instead of requesting it over and over again
less HTTP requests and less data transfer
which means faster load time better functionality
which can lead to lower bounce rates to more time spent on your site
and yay everybody's happier and your SEO rankings get a boost
after all again why waste time with a return site visitor
downloading the same content over and over again
content like your CSS if it's going to be the same every time
so let's go ahead and do that
all I need to do is go to the root directory of my website
and find my htaccess file
this is a hidden file
so if you don't see it be sure to go into your settings and enable the view of hidden files
and add this mod
will have users cache our CSS for one month after they first visit our site
then all those subsequent visits during that month
won't require downloading that CSS again
they'll pull the rest of the site from the server
and use that stored CSS in their cache to render out the style elements
faster than pulling that off the server too
and save
Sweet now we're all done
but what happens if we change that CSS before the allotted expiration date
for instance if we do a revamp of our site and completely overhaul the look
or we even make a tiny change in the CSS
like the font the background image or any other alteration
now that we have those expiration headers
repeat visitors are going to have that old CSS stored
and this may wreak havoc on the display of our website
especially if we've made any changes that affect the layout
well don't sweat it
a super easy workaround for this is to simply make those CSS changes
and save the file under a new name like version 2
then be sure to upload it into the appropriate folder on your server
and pointer HTML to that new file
easy-peasy
now visitors that come to your site for the first time
will get that new CSS and store it
and repeat visitors that come to your site and have the old CSS
well that HTML reference will tell them to grab the new CSS file and store that
instead all smooth sailing
feel free to check out our other videos so you can keep fine-tuning
and getting the most out of your SEO
and click subscribe to stay updated with new tips and tricks
to get you to the top of the search engine results pages