Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-12-2011, 07:38 PM   PM User | #1
reservoirdog198
New to the CF scene

 
Join Date: Jun 2011
Location: Italy
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
reservoirdog198 is an unknown quantity at this point
Prevent direct file download

Hi all,
I have some problems with a PHP site that includes some FLV files in a video player.

I'd like to avoid people downloading the videos by typing the url by hand (ex. http://mysite.com/video/vidTitle.flv), but at the same time, I need the same url to be accessed by the video player on my PHP page.
This video player uses an anchor tag: <a href="/video/vidTitle.flv">...</a>

How can I avoid the direct download from the address bar?
Thanks
reservoirdog198 is offline   Reply With Quote
Old 07-09-2011, 08:33 AM   PM User | #2
Cags
New Coder

 
Join Date: Jul 2011
Posts: 67
Thanks: 0
Thanked 13 Times in 13 Posts
Cags is an unknown quantity at this point
I believe a request for an asset appearing on a page has a HTTP_REFERER flag of your site, so one option would be to check against that and send a forbidden response if it's not your site.

Code:
RewriteCond %{HTTP_REFERER} !www.yourdomain.com
RewriteRule \.flv$ - [F]
This should also stop other sites from hotlinking your assets and using up your bandwidth. It's not a perfectly solution, as there are still ways for somebody to download the file, but it should suffice for most cases.
Cags is offline   Reply With Quote
Reply

Bookmarks

Tags
htac

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:14 PM.


Advertisement
Log in to turn off these ads.