hotlink image rewrite in apache

Categories: General

this is a real simple way to redirect all hotlinked images to another image in apache from either the httpd.conf or an htaccess file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?insert_url_here\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(png|gif|bmp|jpg)$ image_here.jpeg [L]

format is real simple, you just have to change insert_url_here\.com to your url so that any request coming to your server will be redirected to the image in the last line RewriteRule .*\.(png|gif|bmp|jpg)$ image_here.jpeg [L]

make sure to change image_here.jpeg to the path and image that you want to use.


    Leave a Reply

    Your email address will not be published. Required fields are marked *