I want to prevent hotlinking of pdf files when a user is not logged in (with Wordpress) and which begin with "restricted_".
Currently I have the following .htaccess lines:
#RewriteEngine On
#RewriteCond %{HTTP_REFERER} !^(.*)\.oegn\.at/ [NC]
#RewriteCond %{REQUEST_URI} !hotlink\.(pdf) [NC]
#RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
#RewriteRule .*\.(pdf)$ http://www.oegn.at/ [NC]
Right now this prevents of hotlinking every .pdf file. I don't how I can achieve my goal.
To check the file, you can do next:
RewriteCond %{REQUEST_URI} ^/restricted_(.*)\.pdf
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /current_file?=restricted_%1.pdf [R,L]
Now just replace my rewriteRule with what you want.
If you have any questions, let me know.