Reputation: 655
My website does not load the latest changes after pressing CTRL + F5
I made CSS load the latest changes by adding this to my header:
<link rel="stylesheet" href="/assets/css/main.css?v=<?php echo time(); ?>" />
But how do I make my website itself load the latest changes? For example:
From:
<h1>Hello</h1>
To:
<h1>Helloblabla</h1>
When I refresh, it does not load the newest changes. Only after ~2-5 minutes
I have searched a lot, and tried deleting my cache in my Chrome - did not work. I have tried disabling opcache by adding this line in .users.ini in the root folder:
opcache.enabled OFF
and
opcache.enabled=0
But <?php phpinfo(); ?>
tells me it is still enabled... Is it my host that controls this? Is opcache causing this issue?
Upvotes: 0
Views: 4765
Reputation: 42304
Changing <h1>Hello</h1>
to <h1>Hellobla</h1>
is purely HTML; nothing to do with CSS or its cache. Also, it's important to note that HTML and CSS actually have different caches.
To update any HTML, you'll need to actually re-upload the file back to the server. Assuming you're in an IDE, this can be done via a right-click on the file in question. If youre using cPanel or similar, directly editing the file will reflect changes immediately.
It's also possible that you've cached the old content. You can check for this by appending an additional /
to the URL, which is treated as a separate page (though it shows the same content). If you see the new content, then you have indeed cached the old content.
You can refresh the HTML cache with CLTRL + F5, though the CSS cache will need a slightly different shortcut - CTRL + SHIFT + R. This is equivalent to holding SHIFT and clicking on your refresh icon.
Keep in mind that you're using a root-relative link to your CSS file: /assets/css/main.css
. That is to say, your CSS should be in a folder called css
, inside of a folder called assets
at root level. You can confirm that this CSS file is actually getting loaded by bringing up the F12 Developer Tools and checking the Sources
tab.
Also, setting the href
to "/assets/css/main.css?v=<?php echo time(); ?>"
will forcibly update the CSS every time you load that header. This is great for testing, but probably not ideal for production. For production, you'll probably want to just affix a version number instead, so that only major changes to the CSS file will cause a reload.
Hope this helps!
Upvotes: 3
Reputation: 104
PHP is probably not configured to read configuration from .users.ini file. You can find in phpinfo() output the location of php.ini and additional configuration files.
Upvotes: -2