Hotlinking Problems; esp with subdomains

boogie

Registered
Jun 13, 2006
2
0
151
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:
 

Attachments

Shinichi Kato

Well-Known Member
Mar 7, 2005
72
0
156
Saitama-ken,japan
cPanel Access Level
Root Administrator
.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
 

boogie

Registered
Jun 13, 2006
2
0
151
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?
 

Shinichi Kato

Well-Known Member
Mar 7, 2005
72
0
156
Saitama-ken,japan
cPanel Access Level
Root Administrator
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
 

scotty06

Registered
Jun 14, 2006
3
0
151
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