another .htaccess question

liunx

Guest
Does anyone remember what to write in the .htaccess file to prevent linking to images, etc.
I saw somewhere that you in the .htaccess file could revent external sites from linking to your images, etc and you could specify which file types were 'permitted' (e.g. .html etc)

Anyone ?Create a .htaccess file with this in:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://gif.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gif.com/.*$ [NC]
RewriteRule .*\.gif$ - [G]



(Taken from <!-- m --><a class="postlink" href="http://www.perlaccess.com/tutorials/8/8.7.html">http://www.perlaccess.com/tutorials/8/8.7.html</a><!-- m -->)Add the following to the .htaccess file:

# Rewrite Rule for images
RewriteCond %{HTTP_REFERER} <URL of page accessing your domain>
RewriteRule ^(.*)$ <!-- m --><a class="postlink" href="http://">http://</a><!-- m --><same as above URL>

You would replace the <URL of page accessing your domain> above with the domain name and path of the page that is referring to your domain. For example: <!-- w --><a class="postlink" href="http://www.their-isp.net/users/mypage/">www.their-isp.net/users/mypage/</a><!-- w -->

The RewriteCond directive states that if the {HTTP_REFERER} matches the URL that follows, then use the RewriteRule directive. The RewriteRule directive will redirect any reference back to the referring web page.

Source : ( affirmgroup.com (<!-- m --><a class="postlink" href="http://affirmgroup.com/htaccess.htm">http://affirmgroup.com/htaccess.htm</a><!-- m -->) )
 
Top