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.

Hotlinking Problems; esp with subdomains

Discussion in 'General Discussion' started by boogie, Jun 13, 2006.

  1. boogie

    boogie Registered

    Joined:
    Jun 13, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I've been reading a couple of similar threads about this problem, and yet, I still don't get it :mad:

    How is that all my images on my website are successfully hotlink-disabled except for those in my subdomain? I've had loads of thiefs happily hotlinking to the images. :( I do think I'd filled the CPanel hotlinking section correctly, as in the image attachment:

    For instance, this website (which is under my subdomain) can be hotlinked:
    http://listing.crystalled-roses.net/arjun

    I've heard that the solution is to place my .htaccess file in the subdomain directory. But I'm confused here. Right now I only have one htaccess file which is in my main public_html folder, and that was the one generated by CPanel. So my confusion starts about how exactly am I supposed to place it in the subdomain folder. Do I just copy and paste it with the same exact codes as that as the main folder's or do I have to create another different .htaccess file with different codes?


    Well, there goes my subdomain rants, but another problem I want to highlight is that... notice I'd include my livejournal as one of the allowed referrers? Well, how come sometimes I can hotlink but sometimes it can't. It straight directed itself to my error page. :confused: :confused:
     

    Attached Files:

  2. Shinichi Kato

    Shinichi Kato Well-Known Member

    Joined:
    Mar 7, 2005
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Saitama-ken,japan
    .htaccess

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://your.domain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://your.domain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.your.domain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.your.domain.com$      [NC]
    RewriteRule .*\.(jpg)$ http://your.domain.com [R,NC]
    
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>
    <Files *.jpg>
    	SetEnvIf Referer "^http://your\.domain\.com" ref_ok
    	order deny,allow
    	deny from all
    	allow from env=ref_ok
    </Files>
    TMSfrom Japan
     
  3. boogie

    boogie Registered

    Joined:
    Jun 13, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Ooh! Thanks for the reply :D

    Anyways, straight on to biz, I must first say I'm quite slow at the coding uptake :eek:

    I'm still confused here, are those bunch of codes you got there, for me to create a totally new different htaccess file to upload onto my subdomain directory?

    And if so, what about the default htaccess file generated by CPanel which is still sitting in my public_html folder? Do I need to change it? Do I need to edit... delete it? Or are those codes given by you for me to overwrite those whole generated codes by CPanel?


    And as far as the coding goes, I notice only jpg format is included as the sample. How do I change it to more than one formats (ie. gif, bmp, zip, wmv, etc)?

    And which line of the codes do I include to direct the hotlinker to my error page?
     
  4. Shinichi Kato

    Shinichi Kato Well-Known Member

    Joined:
    Mar 7, 2005
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Saitama-ken,japan
    The format that cPanel made doesn't include the above .htaccess.

    Read me.
    http://httpd.apache.org/docs/1.3/mod/core.html#files

    Code:
    <Files ~ "\.(gif|jpe?g|png)$">
    	SetEnvIf Referer "^http://your\.domain\.com" ref_ok
    	order deny,allow
    	deny from all
    	allow from env=ref_ok
    </Files>
    Sorry, I'm poor english.
    TMSfrom Japan
     
  5. scotty06

    scotty06 Registered

    Joined:
    Jun 14, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    The way that I have eliminated hotllinking is by entering the allowed hotlinking, editing that. When dealing with it from subdomains, I haven't placed any of the jpgs/htmls/mps etc. into public folders.
    Hope this helps a lil.
    Scotty06
     
Loading...

Share This Page