Viewing 2 replies - 1 through 2 (of 2 total)
  • If you’re running cPanel, there’s an easy way to do it. Just go to Security -> Hotlink Protection, make sure Hotlink Protection is enabled, that the box for “Allow direct requests” is unchecked. Make sure that all the domains that need to access your images, both HTTP and HTTPS, are in the allowed URLs box. Save your changes.

    You can test it by trying to browse directly to an image’s URL.

    If you’re not running cPanel, but you’re on an Apache server, you can add the following to your .htaccess:

    
    RewriteCond %{HTTP_REFERER} !^https://yourdomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://yourdomain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://www.yourdomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://www.yourdomain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://yourdomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://yourdomain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://www.yourdomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^https://www.yourdomain.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    

    Be sure to change “yourdomain” in the above sample to the name of your domain. You only need the “https” versions of your site if you use SSL.

    Thread Starter Cartographer

    (@cartographer)

    Dear @linux4me2

    Thank you very much for your answer! I use Plesk, so I guess there will be a similar option. I ‘ll try to find it.

    If I don’t, I will try using the .htaccess file.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Protect images (Urls) from showing to non logged-in members’ is closed to new replies.