I have a redirect rule that redirects all PDFs, Word, Excel and Power point documents to a page.
RewriteEngine on
RewriteRule ^(.*).(pdf|doc|docm|docx|dot|dotm|dotx|odt|csv|dbf|dif|xls|xlsb|xlsm|xlsx|xlt|xltm|xltx|xlw|pot|potm|potx|ppa|ppam|pps|ppsm|ppsx|ppt|pptm|pptx)$ http://myurl.ca/file-download-tracker/?file=$1.$2 [R,L]
On that page, I have some code that pushes data about this file to Google Analytics, then redirects back to the file the user was originally trying to access.
I'm trying to write a condition for this rule that will only redirect these files if the user didn't come from the http://myurl.ca/file-download-tracker/?file=myfile.pdf
url but having no luck. How could I write this rule?
Here's the closest I think I've gotten with this condition:
RewriteCond %{HTTP_REFERER} !^http://myurl.ca/file-download-tracker/.*