3

css-file is named: style.css?v=1

the link inside of html: <link rel="stylesheet" href="style.css?v=1">


Contrary to the classic style.css the style.css?v=1 doesn't get recognised:

Failed to load resource: the server responded with a status of 404 (Not Found)

Did I miss something? What's important to versioning files and where does the syntax ?v=1 come from?

2
  • 1
    "the style.css?=v1 doesn't get recognised." Which one are you using style.css?=v1 or style.css?v=1 (as per your link) (correct syntax is ?v=1 and it is called a query string) Commented Nov 22, 2018 at 11:22
  • 1
    Oh thanks, there was a typo – I'm using ?v=1 Commented Nov 22, 2018 at 11:29

1 Answer 1

2
  • The expression style.css?v=1 for the browser means a dynamic file like "fetch me the file style.css with a parameter named "v" set to 1". As long as you change the value of the v parameter, the file will be fetched as a new unique url.
  • The expression style.css?=v1 has no meaning.
  • The expression style.css?1 could also work.
Sign up to request clarification or add additional context in comments.

2 Comments

is the query string only based on naming? Or is there any technical difference between style.css?v=1 and style-v1.css?
The difference between these two is that if you are working on a file style.css and you want to decache it then the ?v={version_number} at the end is enough. The file style-v1.css is different than the file style-v2.css inside your server meaning that you must create a new file each time each time you want to decache it on your browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.