Forum Moderators: phranque
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://mydomain.(.*)/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://(.*).mydomain.(.*)/.*$ [NC]
RewriteRule (.*\.(gif¦jpg¦avi¦mpg¦GIF¦JPG)$) [mydomain.com...] [R,NC]
Although this works very well, it's also blocking the images on my own webpages too!
Presently I've had to set RewriteEngine to off, coz I don't want my website to look stupid.
Can anyone see why this could be happening? If you need to look at the html of my webpage, I'll be happy to post the url.
Welcome to WebmasterWorld [webmasterworld.com]!
It looks to me like a case of over-design. Try simplifying it to:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://.*example\. [NC]
RewriteRule \.(gif¦jpg¦avi¦mpg)$ /public/notallowed.gif [NC]
Regarding the posting of URLs. please review the WebmasterWorld Terms of Service [webmasterworld.com] and our Apache forum charter [webmasterworld.com]. Thanks!
Jim
That's a good point; While substituting .jpeg for .gif or vice-versa usually works, you can't expect a redirect from .jpg to .html to work -- Images are loaded by <SRC> tags and pages are loaded by clicking <A HREF> links, so the two won't mix.
But in this case, the stated problem is that the correct image won't load for accesses which are not blocked, so the image type is not being changed anyway.
Jim