-2
After doing a lot of research on the subject, I will rephrase my question.
It’ll get clearer:
On my website Wordpress, i would like to set the expiration of html files only on the homepage of the website "homepage" so that the browser do not save the cache.
I tried using the code below to set the expiration of all html to 1 week, and of homepage "index.html" to 0.
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 1 week"
<FilesMatch "^(index\.html)$">
ExpiresActive On
ExpiresByType text/html "access plus 0 seconds"
Header append Cache-Control "public"
</FilesMatch>
</IfModule>
But only the 1 week setup worked.
ExpiresByType text/html "access plus 1 week"
Configuration inside "Filesmatch" is completely ignored.
ExpiresByType text/html "access plus 0 seconds"
However, when I try to set file expiration Styles.css instead of index.html, using the same structure, the code works.
Thus, it seems that something related to the fact of defining the expiration specifically of the index.html file within "Filesmatch" prevents the code from working.
I know that wordpress does not own a file index.html, he owns a index php. which generates html. but probably the name of the html file used in the wordpress home page is not index. must be something else.
So the question is, how to set the expiration of the html file only on the home page?
wordpress saves the search cache. if you do not reload the page after each search, you will continue to see outdated results. Need to disable cache only at this search URL. The code I was able to create generates a 500 error.
– lgdelai
See my htaccess: # ALL - 1 YEAR CACHE <Ifmodule mod_expires. c> Expiresactive On Expiresdefault "access plus 1 year" </Ifmodule> # SEARCH RESULTS - 1 SECOND CACHE <Locationmatch "./?s=."> <ifModule mod_expires. c> Expiresactive On Expiresdefault "access plus 1 Second" </ifModule> </Locationmatch>
– lgdelai
What cache are you talking about @lgdelai? And why cache 1s? If it’s a page with thousands of hits per second, it would make sense, but it still wouldn’t be in the polls.
– tvdias
And where it came from "The wordpress saved search cache. if you do not reload the page after each search, continue seeing outdated results."?
– tvdias
Hello @tvdias, thanks for your help so far, I researched a lot about it, and I reformulated my question, I think it will now be much clearer what I want. If you could take a look, thank you.
– lgdelai