The updated .css file does not apply to the website

http://warehouse24.rf.gd/Shed/Dashboard.php
Username is “1”
and the password is “1”

This is my 4th assignment to do. i want to ask about error that i found. the code is work fine, when you look at it directly it will look normal. about 4 days ago I got feedback to reduce the type shifting that occurs on small screen resolutions. currently I am trying to make changes to the css file used in dashboard.php.

I tried to reduce the load by using the dashboard as a template. today I tried to enter the code that I used in my previous assignment. and only after the code I entered was running did this bug occur. so when I tried to resize the nav bar from 60px to 50px and tried to reduce the size of the text that appears in the css file all changes did not occur. until I tried to change the name from style2.css to style3.css then the change applied.

is it because the php file that contains html has its own style sheet?
but when I change the name the new css code applied

I tried to remove the format.php writing a week ago but it didn’t work so I removed the .htaccess. is it affecting to?

Details:
if asking why not developing this on local?
answer is 403 forbidden on xamp.

Check again? yes i was check it about 6 times then i change its name then work

Clear chace? browser done, same result. is there is server chace to?

strange but when I edited dashboard.php and refreshed it immediately the change applied.

thanks for reading. please tell me anything i may try, i only want edit css without editing target file everytime i do small change

This is a issue with the browser cache and not a hosting issue

The web browsers will cache the old version of the css and ignore the updated file

You can try to clear the browser cache but some browsers are really stubborn and still refuse to update

The best thing is to use a new file name when you make a change css001.css css002.css etc to force the browser to use the new version

I also had this same issue and I ended up having to write a small bit of php code to handle this automatically without having to make changes to filenames and pages, see this link below

5 Likes

That actually won’t work unless the cache for the HTML page updates as well. If the HTML page is still an older cached version, it will still call the old CSS files.

What I would do is setup a redirect at the server level (Like in .htaccess or PHP) to direct the old CSS file to the new one.

Or just change the cache period and use a service like CloudFlare that can manage it for you and provides and easy way to clear the cache for a file

6 Likes

yeah sorry I meant to say change the css file name and then hard refresh the page

but i prefer to use the php way

3 Likes

Thanks, would you like to give me an example of .htaccess content?
Sorry, I’m still not used to use .htaccess

Redirect 301 /old/file.css /old/new.css

Don’t change the HTML

Of course this still relies on cache, so it’s really only a half-solution.

The best way to fix this is to do this:

Or just accept that it may take a few days before everyone sees the newest version of your site (It’s really not the biggest deal in the world)

3 Likes

I wouldn’t have guessed that the browser would use the old chace file even when I cleared it.

From
link rel=“stylesheet” href=“…/Css/Style2.css”

to this
link rel=“stylesheet” href=“…/Css/Style2.css?v=<?php echo time(); ?>”

i still not doing change to javascript yet. please can you give me example if .js file is on another folder. honestly i still confused about how to target the location

but this is work thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.