Forum Moderators: phranque

Message Too Old, No Replies

Help Modifying .htaccess File

im wanting to change this to display an

         

kindredmwa

4:52 pm on Feb 25, 2003 (gmt 0)

10+ Year Member



I am wanting to change my existing .Htaccess file to display a Ad picture for hotlinkers...what do i need to change to do this..below is my current code..


RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.229\.(3[2-9]¦[45][0-9]¦6[0-3]).*(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://babel.altavista.com/.*(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.243\.113\.1/cgi/
RewriteCond %{HTTP_REFERER}!^http://search.*\.cometsystems\.com/search.*(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://.*searchhippo\.com.*(www\.)?mysite\.com [NC]
RewriteRule \.(gif¦jpg¦jpeg?¦ra¦rm¦ram)$ - [NC,F]

thanks for any help.

jdMorgan

5:23 pm on Feb 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



kindredmwa,

To be sure this will work (especially with the RealNetwork-format-files, you should create a hotlinker image in each format and use this new RewriteRule with your existing RewriteConds:


RewriteRule \.(gif¦jpg¦jpeg?¦ram?¦rm)$ /hotlink_image.$1 [L]

Otherwise, most browsers will probably be able to handle it if you use:

RewriteRule \.(gif¦jpg¦jpeg?¦ram?¦rm)$ /hotlink_image.jpg [R,L]

The issue here is to avoid the situation where the browser requests one type of file and gets another, which it may not be able to handle. The second version uses an external redirect to tell the browser to re-request the new image file. In this case, the client will be aware of the redirection.

Replace the broken vertical pipes "¦" above with the solid one from your keyboard! Spaces are required before the "!" character in your RewriteRules. Both of these are side-effects of posting on WebmasterWorld.

Also, see this useful Introduction to mod_rewrite [webmasterworld.com] post and the links to references it includes.

HTH,
Jim

kindredmwa

5:49 pm on Feb 25, 2003 (gmt 0)

10+ Year Member



thanks alot for the help..but one more question..how do i create a hotlinker image for .rm files?

do i make a blank movie file or something else?

thanks,you are truly a genius.