rubble — 2013-05-08T16:26:14-04:00 — #1
I have a website with 8 price lists and they are linked from 3 different places.
Currently when I upload the price lists I keep the name the same. This time I noticed in IE that in one case the old price list was still displayed and even when the price list was removed it still displayed the old one! Clearing the browser history fixed it but when users visit the site they may still see the old version.
I see my options as:
Rename the files every time which means changing 24 links - a pain.
Put the file names in a database - only need to change 8 items not 24 - less of a pain.
Read the directory containing the price lists and some how change the links to the new version - prefered method but I am not sure how to impliment. Possibly use explode or a regex?
force — 2013-05-08T16:38:36-04:00 — #2
Are you using a CMS to display these links?
I'm not sure if it helps ease the burden of updating the links, but you can tack on a versioning query to the URL, like this:
So when you upload the new file, you just change the query portion of the URL.
possible solution is to replace all the links with a short URL, and have the short URL link to the new file each time.
So, when you have a new file to upload, you just update the source link in your short URL service, but the short URL that is posted everywhere won't change.
rubble — 2013-05-08T17:15:06-04:00 — #3
No I am not using as CMS as such but am using a navigation include on every page.
@Force_Flow ; Your comments have made me think that if I add some variables to the navigation file with the pdf file names; all I will need to do is update those every time. I can then echo the variables where I have the links. The new filenames of the price lists will just have the date on the end as you suggested.
stevie_d — 2013-05-08T18:38:43-04:00 — #4
Sounds like you would be better off setting a cache control on the server, to tell user-agents to fetch a new version. I've not tried this myself, but this code in your .htaccess should set an expiry date of 24 hours on all PDF files, after which time they should not be cached.
Header set Cache-Control "max-age=86400, public"
rubble — 2013-05-09T02:56:58-04:00 — #5
That sounds better @Stevie_D ; as it would need no more input from me.
I will give it a go tonight and if it does not work I will try reading the folder of images into an array; finding a file with a name that for instance starts with Toy and putting that into a variable which I can use in my link.
rubble — 2013-05-09T13:08:32-04:00 — #6
I have just been working on creating dynamic variables and have remembered why I wanted the names to stay the same. If the user bookmarks the pdf and wants to come back to it at a later date and the name has changed they will get an error. The .htaccess method would be the best way to go if it works.
force — 2013-05-09T16:02:57-04:00 — #7
If you use a query variable after the (same) filename, bookmarks don't break.
would load the cached document, so nevermind.
If you use the htaccess method for a specific file/folder, that might be the best approach.
rubble — 2013-05-09T17:11:16-04:00 — #8
The .htaccess code seems to have worked but can not be sure until I recive some more price lists tomorrow.