View Single Post
Old 04-12-2008, 09:51 AM   #5 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

For the CSS file with a versioning string, it's simply to make sure that when a new version of the CSS file is uploaded people can immediately see the changes (because the URL will change) since the cache won't be made for that particular URL. A simple solution would be to load in the specified CSS file (using Apache, PHP, etc.) or a default one if it does not exist (or 404 ;)).

With the stylesheet on the W3C site, the correct file will show up because their web server is using Content Negotiation (Apache). Full details are at the 'Apache' link just posted, but essentially (depending how you have things set up) Apache will look for files in that location and deliver the best match, if any. For example, on my local server I can access http://localhost/mydir/myfile which might call a PHP script if there is a myfile.php available. If I created a myfile.html and accessed the same URL, the displayed page would be the HTML document because that overrules the PHP file. If I got rid of the HTML and PHP file but instead placed a myfile.png there, the same URL would display the image. (Note: This is not mod_rewrite!)

If you try to access http://www.w3.org/StyleSheets/TR/W3C-WD.css then you'll get the stylesheet. If you try instead to access http://www.w3.org/StyleSheets/TR/W3C-WD.html, you'll get a 300 Multiple Choices header with in this case a list of available files.
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
SOCK (04-12-2008)