how to use .htaccess to prevent image from bing viewed but still being displayed on the page

[ad_1]

I need to be able t not let using view the image by going www.domain.com/image/file.jpg

and the below code does that when the image is opened like above you get a 403

RewriteCond %{REQUEST\_URI} \^/actorimages/{.\*} \[NC\]

RewriteCond %{REQUEST\_URI} \\.(jpg|png)$ \[NC\]

RewriteRule \^/actorimages/(.\*)$ [www.google.com]) \[NC,U,QSA\]

​

But now the image does not display on the page and it gives a broken image

​

how to I allow it to be displayable on the page but disallow direct access to the image like above?

[ad_2]
2 Comments
  1. The keywords you need to google are “prevent hotlinking htaccess”. Essentially you check the Referrer host header and if it isn’t your website, block the request.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer