• Resolved Oosten Marc

    (@onzinpiet)


    Hi,

    I hope you can help me with the following problem. I activated the hotlink protection option in the cpanel of my hosting company for my multisite network. Besides the multisite network (below named as ‘myfirstdomain’) I run another add-on domain on the same server (below named as ‘mysecondaddondomain’ which is located in a seperate directory: /public_html/mysecondaddondomain).

    I discovered that the hotlink function doesn’t work. I’ve found various site using my images and bandwidth. Most of them are blogspot blogs.

    I hope you can please help me with this to discover what I do wrong or if there are errors in the (anonymized) .htaccess file below.

    Thanks a lot for your help!

    Piet.

    This is my current .htaccess file in the /public_html directory:
    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 15 replies - 1 through 15 (of 30 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Thread Starter Oosten Marc

    (@onzinpiet)

    Hi Ipstenu,

    Thanks for your information. I used a similar site before with techniques to edit my .htaccess file to obtain hotlink protection. But unfortunately with no solution.

    I’m afraid that there is something wrong/interfering with the codes in my current .htaccess file. Sorry I wasn’t aware enough about the forum rules. I now used pastebin to show you the code:

    <script src="https://pastebin.com/embed_js.php?i=RCNGtEmy"></script>

    Thanks for your help.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    First put WordPress at the bottom and your hotlink at the top ??

    Then this stuff is … you have too much repetition.

    Notic how you have *.myfirstdomain AND mail.myfirstdomain? You’re duplicating efforts.

    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{HTTP_REFERER}     !^$
     RewriteCond %{REQUEST_FILENAME} -f
     RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$           [NC]
     RewriteCond %{HTTP_REFERER}     !^https?://([^.]+\.)?myfirstdomain\. [NC]
     RewriteCond %{HTTP_REFERER}     !^https?://([^.]+\.)?myseconddomain\. [NC]
     RewriteRule \.(gif|jpe?g?|png|bmp)$                             - [F,NC,L]
    </ifModule>

    That should be ALL you need.

    Thread Starter Oosten Marc

    (@onzinpiet)

    Thanks a lot for your advice. I’m not an expert on this, sorry for that and for asking the following.

    Can I delete all the code of my .htaccess file and replace them with the codes you gave me (putting my domain names in it)?

    In other words: do I need this content for my .htaccess:
    https://pastebin.com/embed_js.php?i=GQkST1sh

    Or the one you gave me?

    Thread Starter Oosten Marc

    (@onzinpiet)

    Hi, I tried what you suggested me in various ways, but it didn’t work. Can you please indicate me where I made an error?

    1. First I tried the following code as entire code for the file:

    <iframe src="https://pastebin.com/embed_iframe.php?i=mcwa37j2" style="border:none;width:100%"></iframe>

    2. After that I tried only the code you suggested me for the file (without WP-codes):

    <iframe src="https://pastebin.com/embed_iframe.php?i=dXSAHmMJ" style="border:none;width:100%"></iframe>

    Is this piece of code always necessary in the .htaccess file?

    <iframe src="https://pastebin.com/embed_iframe.php?i=7tsDDkiN" style="border:none;width:100%"></iframe>

    Thanks!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Did you happen to notice how many extra slashes you have in there?

    https://pastebin.com/4681dK4p

    Thread Starter Oosten Marc

    (@onzinpiet)

    Hi Ipstenu,
    I tried the last (pastebin) code you gave me but it doesn’t work. And besides that the images of ‘myfirstdomain.com’ don’t appear now. The ones of the seconddomain.com do appear normally.
    Is there some code lacking in the beginning of the codes?
    Thanks a lot for your help!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You’ll have to read the doc I linked to for other versions. Not all .htaccess setups are the same, and there’s always experimentation.

    Thread Starter Oosten Marc

    (@onzinpiet)

    Hi,

    I’m not an expert in this, but I tried everything that is suggested on the site you mentioned.

    I have 2 domains (the 2nd is a so called add-on domain) and the 1st has WordPress Multisite enabled (sub-directories), I don’t know if that’s the problem.

    I don’t know if you or anybody else can offer an alternative that can help me, honestly I don’t now what more I can do or where to ask for help.

    Thanks.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Ask your webhost at this point, since they may have something set up to stop it from working. But that code is exactly what I use for my site with an add-on domain (and even for a domain that isn’t even mine – I like giving my tumblr account permissions to use my images). I know the code is valid for MOST sites.

    Thread Starter Oosten Marc

    (@onzinpiet)

    Hi Ipstenu,

    I solved the problem I had with the hotlink protection, thank you so much for your information!
    Now I tried to give permission to the translator of Google (to add it to the whitelist), but it doesn’t work. I’ve tried the following 2 options:

    RewriteCond %{HTTP_REFERER} !^http(s)?://(www|translate)\.?google.* [NC]
    RewriteCond %{HTTP_REFERER} !^https://(www\.)?translate.google.com/.*$ [NC]

    I can’t find information about this on the Internet, do you have a suggestion to solve this?

    Thanks a lot in advance!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What’s the hotlink protection code you’re using? There are a few variants.

    Thread Starter Oosten Marc

    (@onzinpiet)

    I use this :

    https://pastebin.com/4681dK4p

    Thanks.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?google\. [NC]

    should do it

    Thread Starter Oosten Marc

    (@onzinpiet)

    I will try this and will inform you about it.

    Does this permit everything of Google?

    Thanks a lot!

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘Hotlink protection not working’ is closed to new replies.