Hi again. Got another .htaccess question I currently do this (see code) in order to block direct downloads and websites trying to steal my bandwidth. RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC] RewriteRule .*\.(mp4)$ forbidden/forbidden.mp4 [R,NC] Code (markup): But I would like to cut down the www and non-www condition to (all non-my-domain) referrers. And what's more important right now, I want to set the rewrite rule so that only mp4 files from the mydomain.com/videos/mp4 folder are redirected to mydomain.com/forbidden/forbidden.mp4 Help would be awesome Thanx Martin
You only really need one RewriteCond, just use some regex magic so the 'www' is optional. Something like: RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mydomain\.com/ [NC] RewriteRule .*\.(mp4)$ forbidden/forbidden.mp4 [L,NC] Code (markup):
THAAAaaaAAAnx And if I only want to redirect the mp4's if they are in video/mp4/*.* Would this be right? RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mydomain\.com/video/mp4 [NC] RewriteRule .*\.(mp4)$ forbidden/forbidden.mp4 [L,NC] Thanx M.
Then you would change the RewriteRule. (the RewriteCond is just making sure the referer doesn't contains your URL) RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mydomain\.com/ [NC] RewriteRule video/mp4/(.*)\.mp4$ forbidden/forbidden.mp4 [L,NC] Code (markup):