The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FrontPage & Hotlink Problem

Discussion in 'General Discussion' started by Gambid, Mar 6, 2004.

  1. Gambid

    Gambid Registered

    Joined:
    Mar 6, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Today I found that someone steal my bandwight by direct linking my images. So I activered my Hotlinks protection to stop him. It works great. But when I activated it my FronPage Extension stoped working. I reinstall them, but nothing changed. When I disable hotilnks protection they start working again. Why can't the both scripts work toghter. What's wrong.
     
  2. geneticfreak

    geneticfreak Member

    Joined:
    Dec 30, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Reading, PA
    I am having the same problem here. The bad thing is when you go to enable it again, you have to re-enter the list of sites allowed if you are allowing more than just your own.:(
     
  3. dennis

    dennis Well-Known Member

    Joined:
    Apr 22, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Singapore
    the hotlink protection in Cpanel never worked anyway since i used Cpanel 7.

    Do this manually :

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^[url]http://[/url]([a-z0-9-]+\.)*yourdomain.com* [NC]
    RewriteRule /* [url]http://www.yourdomain.com/hotlinkdisabled.gif[/url] [R,L]
    

    and save it as .htaccess and drop it into the folder you need to protect.

    under [NC], place the url which are allowed to hotlink.

    under [R,L] place the image u would like those leechers to see in replace of the original pic.

    Here's a sample for my gallery :

    [​IMG]
     
  4. geneticfreak

    geneticfreak Member

    Joined:
    Dec 30, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Reading, PA
    Snappy! I'll give this a try.

    I would imagine that this should solve my next question. I want to protect video files by redirecting to an error page, which will redirect to my main page after a few seconds. And I also want to protect images with a graphic of a similar nature as yours. The images and videos are in separate folders, so I assume that I need to save different .htaccess files in each folder.
     
  5. geneticfreak

    geneticfreak Member

    Joined:
    Dec 30, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Reading, PA
    I got it to work for my image folder, but not for my video folder. For the videos, I can't even access the files from my own site.:( It just redirects to the error page.

    Here's the code I used for the video folder:
    It's exactly the same as the code that I used for the image folder with the exception of the redirect url.

    Any ideas?
     
  6. Izzee

    Izzee Well-Known Member

    Joined:
    Feb 6, 2004
    Messages:
    469
    Likes Received:
    0
    Trophy Points:
    16
  7. geneticfreak

    geneticfreak Member

    Joined:
    Dec 30, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Reading, PA
    Nope, that actually made it worse. In the media player, it shows the error image instead of the video.

    Another thing, the sites that I have listed to allow will only show the error image.
     
  8. Izzee

    Izzee Well-Known Member

    Joined:
    Feb 6, 2004
    Messages:
    469
    Likes Received:
    0
    Trophy Points:
    16
    [flags]

    as the third argument to the RewriteCond directive. Flags is a
    comma-separated list of the following flags:

    'nocase|NC' (no case)
    This makes the test case-insensitive, i.e., there is no
    difference between 'A-Z' and 'a-z' both in the expanded
    TestString and the CondPattern. This flag is effective only
    for comparisons between TestString and CondPattern. It has no
    effect on filesystem and subrequest checks.

    'ornext|OR' (or next condition)
    Use this to combine rule conditions with a local OR instead of
    the implicit AND. Typical example:
    RewriteCond %{REMOTE_HOST} ^host1.* [OR]
    RewriteCond %{REMOTE_HOST} ^host2.* [OR]
    RewriteCond %{REMOTE_HOST} ^host3.*
    RewriteRule ...some special stuff for any of these hosts...

    Without this flag you would have to write the cond/rule three times.
    Example:

    To rewrite the Homepage of a site according to the ``User-
    Agent:'' header of the request, you can use the following:

    RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*
    RewriteRule ^/$ /homepage.max.html [L]

    RewriteCond %{HTTP_USER_AGENT} ^Lynx.*
    RewriteRule ^/$ /homepage.min.html [L]

    RewriteRule ^/$ /homepage.std.html [L]
    [/flags]

    So add ,OR to 1st line and subsequent lines but not the last line.

    HTH

    Edit: The way I understand this Rewrite Cond/Rule is that those urls listed will be redirected to the error page. Check with Apache about the Rewrite Directive.
    [b]http://httpd.apache.org/docs/mod/mod_rewrite.html[/b]

    Here's a quote from this Apache page about this subject.
     
    #8 Izzee, Apr 30, 2004
    Last edited: Apr 30, 2004
Loading...

Share This Page