Results 1 to 10 of 10
Thread: Quick .htaccess question
-
08-26-2009, 06:24 PM #1Newbie
- Join Date
- Aug 2009
- Posts
- 13
Quick .htaccess question
Hi everyone,
I have what is probably a simple question about mod_rewrite.
I am trying to disable hotlinking for mp3 files, unless it is a swf file on my site trying to play the file.
I tried this:
Code:RewriteCond %{HTTP_REFERER} !^http://(www.)?mysite.com/niftyplayer.swf\?file=.*$ [NC] RewriteRule .*\.mp3$ - [F,NC]
If you could please help me understand what I am doing wrong that would be great! Thanks!
-
08-26-2009, 06:52 PM #2Junior Guru Wannabe
- Join Date
- Apr 2009
- Posts
- 57
Hi hosty567,
With a quick google search, I found this:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?your-domain.com/.*$ [NC]
RewriteRule \.(gif|jpe?g|png)$ - [F]
Just insert mp3 in the RewriteRule and it should work. This is where I found the info:
http://www.besthostratings.com/artic...t-linking.htmlCIRRACORE
http://www.colocube.com
Enterprise and Private Cloud Services, Dedicated Servers, Fully Managed Servers, Colocation Rack and Cage Space, Tier 1 Bandwidth
sales@cirracore.com
-
08-26-2009, 06:57 PM #3Newbie
- Join Date
- Aug 2009
- Posts
- 13
Thank you for your response. I have tried that one before but it doesn't work. In a previous thread, I had asked how to stop hotlinking of jpgs and this works:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|wmv|css|js)$ - [F,NC]
-
08-26-2009, 07:18 PM #4Junior Guru Wannabe
- Join Date
- Apr 2009
- Posts
- 57
Hmm,
Just curious have you tried removing the niftyplayer.swf\?file=.* from your RewriteCond and see if your player can play the file? You probably have, but I thought I would ask. *S*CIRRACORE
http://www.colocube.com
Enterprise and Private Cloud Services, Dedicated Servers, Fully Managed Servers, Colocation Rack and Cage Space, Tier 1 Bandwidth
sales@cirracore.com
-
08-26-2009, 07:20 PM #5Newbie
- Join Date
- Aug 2009
- Posts
- 13
I think I did try that. But anyway I'm just storing my mp3s in a database. It might not be the best way but they are small files and there are only about 150 of them. Thanks for all your help!
-
08-26-2009, 07:24 PM #6Junior Guru Wannabe
- Join Date
- Apr 2009
- Posts
- 57
Hey I just found a hotlink code generator if you want to try figuring it out with that: http://www.htmlbasix.com/disablehotlinking.shtml
Good luck, sorry I couldn't be more help.CIRRACORE
http://www.colocube.com
Enterprise and Private Cloud Services, Dedicated Servers, Fully Managed Servers, Colocation Rack and Cage Space, Tier 1 Bandwidth
sales@cirracore.com
-
08-26-2009, 07:25 PM #7Newbie
- Join Date
- Aug 2009
- Posts
- 13
That's ok, you didn't have to help me at all. I think the problem is that Flash files don't give a referrer when they open a URL. I've been googling and it seems that's the problem.
-
08-26-2009, 07:31 PM #8The Linux Specialist
- Join Date
- Mar 2003
- Location
- /root
- Posts
- 23,991
Moved > Technical & Security Issues.
Specially 4 U
Reseller Hosting: Boost Your Websites | Fully Managed KVM VPS: 3.20 - 5.00 Ghz, Pure Dedicated Power
JoneSolutions.Com is on the net 24/7 providing stable and reliable web hosting solutions, server management and services since 2001
Debian|Ubuntu|cPanel|DirectAdmin|Enhance|Webuzo|Acronis|Estela|BitNinja|Nginx
-
08-26-2009, 07:32 PM #9Junior Guru Wannabe
- Join Date
- Apr 2009
- Posts
- 57
LOL I don't mind helping if I can. *S*
Didn't think about the flash players not providing a referrer.
Good luck.CIRRACORE
http://www.colocube.com
Enterprise and Private Cloud Services, Dedicated Servers, Fully Managed Servers, Colocation Rack and Cage Space, Tier 1 Bandwidth
sales@cirracore.com
-
08-26-2009, 07:33 PM #10Newbie
- Join Date
- Aug 2009
- Posts
- 13
Yeah it's really a pain.
Similar Threads
-
htaccess question
By Mekhu in forum Hosting Security and TechnologyReplies: 5Last Post: 10-03-2008, 12:40 AM -
another htaccess question
By samdax in forum Programming DiscussionReplies: 10Last Post: 11-19-2007, 05:05 AM -
.htaccess Question..
By InvisionSrv in forum Hosting Security and TechnologyReplies: 5Last Post: 08-30-2005, 08:32 AM -
htaccess question...
By theqase in forum Hosting Security and TechnologyReplies: 8Last Post: 07-21-2005, 05:56 PM -
Question on htaccess
By jmc67 in forum Hosting Security and TechnologyReplies: 2Last Post: 08-27-2004, 06:56 PM