|
Deflecting
users based on referer(HTTP header)::
Use the following ruleset...
RewriteMap deflector txt:/path/to/deflector.map
RewriteCond %{HTTP_REFERER} !=""
RewriteCond ${deflector:%{HTTP_REFERER}}
^-$
RewriteRule ^.* %{HTTP_REFERER} [R,L]
RewriteCond %{HTTP_REFERER} !=""
RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND}
!=NOT-FOUND
RewriteRule ^.* ${deflector:%{HTTP_REFERER}}
[R,L]
... in conjunction with a corresponding
rewrite map:
##
## deflector.map
##
http://www.badguys.com/bad/index.html
-
http://www.badguys.com/bad/index2.html
-
http://www.badguys.com/bad/index3.html
http://somewhere.com/
This automatically redirects the request
back to the referring page (when "-" is
used as the value in the map) or to a specific
URL (when an URL is specified in the map
as the second argument).
Blocking
Inline Images::
This is used to prevent cross linking of
your images.
Suppose
we want to protect graphics on webmastering.info,
we use
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.webmastering.info/.*$
[NC]
RewriteRule .*\.gif$ - [F]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !.*/foo-with-gif\.html$
RewriteRule ^inlined-in-foo\.gif$ - [F]
Additional resources
http://httpd.apache.org/docs/mod/mod_rewrite.html
|