Redirect rule to cache bust for PDFs
-
Is there a way to append a query string parameter to all PDF requests on a site?
Something like this:
Source URL (regex): ^(\/)(wp-content\/uploads\/.*\.[pP][dD][fF])$
Match: URL only
Target URL: /$2?ver=[unixtime]We’re trying to figure out how to force fresh downloads of PDFs on our site every time. We often reuse the same file name to avoid having to update links to 3rd party sites, but want to ensure the latest version of the PDF is delivered.
When we try the redirect rule above, it doesn’t appear to do anything. Nothing appears to be logged when we try to access a PDF on the site.
We have another redirect rule that basically provides a short URL for all of our PDFs in our media library and it appears to be working correctly. The redirect activity is being logged as well:
Source URL (regex): ^(\/[a-zA-Z-_\d]+\.[pP][dD][fF])
Match: URL only
Target URL: /wp-content/uploads$1
- The topic ‘Redirect rule to cache bust for PDFs’ is closed to new replies.