Rewrite rules

hi guys,

can anyone please translate for me the below rewrite rules? regex and
rewrite is not my best quality unfortunately :frowning: i know about rtfm …
but it’s just a thing that doesn’t stick with me.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domain1.net [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domain2.net [NC]
RewriteRule .(zip|mp3)$ - [NC,F,L]

Stefanita rares Dumitrescu wrote:

hi guys,

can anyone please translate for me the below rewrite rules? regex and
rewrite is not my best quality unfortunately :frowning: i know about rtfm …
but it’s just a thing that doesn’t stick with me.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domain1.net [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domain2.net [NC]
RewriteRule .(zip|mp3)$ - [NC,F,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^Website Domain Names, Online Stores & Hosting - Domain.com [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^Website Domain Names, Online Stores & Hosting - Domain.com [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com$ [NC]
RewriteRule .*.(jpg|jpeg|gif|png|bmp)$ http://www.domain.com [R,NC]

in case anyone is wondering what is this, it’s hotlinking protection.
i can do anything else but rewrite :slight_smile:

On Friday 25 January 2008, Stefanita rares Dumitrescu wrote:

RewriteRule .(zip|mp3)$ - [NC,F,L]
i can do anything else but rewrite :slight_smile:
server_name domain.com www.domain.com;

valid_referers none blocked server_names;

location ~* .(zip|mp3)$ {
if ($invalid_referer) {
return 403;
#rewrite / http://www.domain.com/;
}
}

Roxis wrote:

On Friday 25 January 2008, Stefanita rares Dumitrescu wrote:

RewriteRule .(zip|mp3)$ - [NC,F,L]
i can do anything else but rewrite :slight_smile:
server_name domain.com www.domain.com;

valid_referers none blocked server_names;

location ~* .(zip|mp3)$ {
if ($invalid_referer) {
return 403;
#rewrite / http://www.domain.com/;
}
}

thanks !

i got the final config as:

   location ~* ^.+.(zip|mp3)$ {
            if ($invalid_referer)
            {
               #return 403;
               rewrite / http://www.domain.com/;
            }
            root              /home/user/public_html;
            expires           30d;
    }