2

I'm wondering how to target the picture in this following code:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://dooomain.com/.*$     [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dooomain.com/.*$ [NC]
RewriteRule .*.jpg$ -                           [L]

not really sure where I have to insert the jpg file!! is it in the web root folder or where?

Thanks

Update #1

ok, maybe I found something to my answer, but not sure so please guys correct me if I'm wrong...

here is the code I should add instead of the last line in my main post:

RewriteRule \.(gif|jpg)$ https://www.mydooomain.com/pic.gif [R,L]

and I need to place the picture in the root in this case, is that right???

Thanks

Martin
  • 22,212
  • 11
  • 70
  • 132
Digital site
  • 4,431
  • 12
  • 48
  • 72

1 Answers1

4

The last rule above is fine. But rewritecond can be done in a single line.

RewriteCond %{HTTP_REFERER} !^(?:$|http://domain.com|http://www.domain.com) [NC]
RewriteRule \.(gif|jpg)$ https://www.mydomain.com/pic.gif [R,L]
ThinkingMonkey
  • 12,539
  • 13
  • 57
  • 81