Here in this article I going to show you, how we can remove unwanted image sizes from wordpress theme. Using code snippet, remove unwanted image sizes

how to protect your images on wordpress

Question is, how to protect your images on wordpress. Some time back our server got so much load and bandwidth of server is taken by other websites. preventing images from used by other site is important.

how to protect your images on wordpress

we checked the access to log of my site. we saw the request for my site images through other site. I decided to stop that. Earlier I written good article about this.

https://purabtech.in/protect-images-accessing-server-apache/

I written simple rewrite rule with mod_redirection.

Just open your .htaccess file from your root folder and following code in that.

#Replace ?wordpressapi\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?wordpressapi\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]

dont forget to replace your blog name.

 

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “how to protect your images on wordpress”

Leave a Reply to John Cancel reply

Your email address will not be published.