You are here: Blog » Code Snippets » Block Images From Google

Block Images From Google

This short snippet will help you block images from Google, other search engines, and the general public. Your images will be able to be included on your website pages, however they won’t be accessible directly (ie via www.yourdomain.com/image.jpg, for example), won’t be accessible by Google and other search engines, and won’t be accessible by any other websites.

The Code

Add the following to your htaccess file:

You would change “yourdomain” to whatever your domain name is. The code above will show a 404 error page when image URLs are accessed directly. Also note that you should clear your browser cache before testing to see if this works.

FYI if you are looking for an easy way to block access to your WordPress site, a way that doesn’t require you messing around with the htaccess file, you can check out my Hide My Site WordPress plugin.

Thanks for taking the time to follow this tutorial. Hope you find it helpful. Please let me know if you have any questions or other feedback in the comments.

This entry was posted in Code Snippets, Tutorials and tagged by .

Author: justin saad

Justin Saad is first and foremost a husband and a father of four. He is also a web developer and designer who has been making websites for over twenty years. His company is called The Motech Network and his website is ClevelandWebDeveloper.com. In addition to building websites, Justin makes WordPress plugins and likes writing tutorials to help others learn about various aspects of web development.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">