Reputation: 43
I have a WordPress website in which I have uploaded courses and I don't want these video URLs to be directly accessible. Based on my research I have to prevent direct access using my .htaccess file, but I cannot figure out how to make it work. No matter what I do, I can access the video if I insert the URL.
Here are all the commands I have tried:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?medguide.krd[NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?medguide.krd.*$ [NC]
RewriteRule \.(mp4)$ - [F]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?medguide.krd/wp-content/uploads/.*$ [NC]
RewriteRule \.(mp4)$ - [F]
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?medguide\.krd/ [NC]
RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov) [NC]
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule .*\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov)$ http://medguide.krd/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?medguide.krd/ [NC]
RewriteRule \.(mp4)$ - [F,NC]
I can't seem to get it working. Here's the actual URL when I right click the video and click "get video address": https://medguide.krd/wp-content/uploads/1-Welcome-to-the-course.mp4
I know the video isn't mine, I have just put it there for test purposes.
Upvotes: 1
Views: 998
Reputation: 61
You can prevent Hotlinking through
cPanel (if your hosting company has this option)
CDN (Cloudflare is free best option)
WordPress Plugin (All In One WP Security & Firewall) or any other security plugin with the option to prevent Hotlinking.
Upvotes: 0