MyBB Community Forums

Full Version: need a code for protect my images
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I need a code for protect images with .htaccess
I want to show my images only on my host and if a person use my images in his site show other image like /copyright.jpg

how can I do it?

/sorry for my bad English Big Grin
If you have cPanel I remember there being a setting for this. Otherwise google hotlink protection.
I use directadmin
what's your opinion about this ?

RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ 
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your “don’t hotlink” image url
RewriteRule .*\.(jpe?g|gif|bmp|png|jpg)$ /images/nohotlink.jpg 
I remember MyBB or the MyBB SEO plugin doing this automatically in .htaccess file.. but since you're wanting to just stop hotlink why not sign up on cloudflare for both free CDN (your site will load faster) and the added bonus of auto hotlink prevention.