It literally means delete all the text in the file and replace it with the code you want in it. For example, replace everything in the file so it only has the code below.
<IfModule mod_expires.c>
ExpiresActive On
# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
# Video
ExpiresByType video/webm "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"
# Fonts
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
# CSS, JavaScript
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
# Others
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
</IfModule>
@robertz did great. Although he did put a â at the beginning of his htaccess file, if he could remove that it would be great. And not to be picky, but itâs also not lined up
robertz
To implement caching headers you would need to go to the vPanel file manager or connect via ftp. Then you would need to open the .htaccess file. If you donât have one, just create itâŚThen paste in this code:
thats is the wrong procedure, is it not ?
you can see from the above screenshots
thats not possible.
Yes, but the .htaccess file must not be in the root folder. It has to be in the /htdocs folder.
No, itâs not the wrong procedure. It is correct.
I told you to download and fix the file above because I donât think you can create a file starting with a dot [.] in the online file manager (I think FileZilla allows it though). So since you were having trouble creating the file, I decided to give it to you, and all you have to do is upload it to the server (in the /htdocs directory) and open it up (edit it) with the code that you want in it. Also, never give up because itâs hard, pushing through is the only way to learn (And if you continue on the same page (like web design) you will most likely need those skills later, so the earlier you learn them, the less time you have to spend worrying about it later).
Thanks
The first one Iâm sure is an accident, it happens to everyone. The second one should be implied, since you cannot upload or edit files in the root directory, and the .htaccess file there has a big âDO NOT EDIT MEâ at the top.
Nope.
Itâs really quite simple.
Download the file from above
Upload it to the /htdocs folder
Open it in the online home manager editor
Remove all the text in the file
Copy and paste the code I cave you above into the file
This is not true.
This only works if all your past users access the website in those few minutes.
If they donât, and you put the old .htaccess rules back on after a few minutes, the userâs browser will never see those changes and keep using the old cached files.
The best way to solve this is attributing versions to your cached files to make the userâs browser think that these are new files.
So, if you have this:
<link rel="stylesheet" href="css/styles.css" />
You can force your userâs to fetch the changed files doing something like this: