phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
How to protect media file using mod rewrite

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
::  
Author Message
huyhoa



Joined: 02 Dec 2006
Posts: 9

How to protect media file using mod rewritePosted: Tue Jun 19, 2007 3:38 pm    Post subject: How to protect media file using mod rewrite

I have a music site that i host my own music at a share hosting. But, i had been hide link, some newbie cant view but some one still can see and can get all link in folder by using Flashget or IDM.
I cant use hot link, becoz if use, my music site cant play music. Please help me, limit connect from 1 Ip so, i thinks, i only give 1 Ip about 1 or 2 connect to my music host site. So, they cant use IDM or Flash get. And do you have any idea please help me and give me a code that limit the connecttion to my music host?
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14854

How to protect media file using mod rewritePosted: Fri Jun 22, 2007 11:03 am    Post subject: Re: How to protect media file using mod rewrite

And welcome Very Happy

It's pretty much impossible to make sure the content you serve won't be copied, but you can limit thing using anti hot-linking techniques.

Take a look at this topic and feel free to ask for help if you need some Wink

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
huyhoa



Joined: 02 Dec 2006
Posts: 9

How to protect media file using mod rewritePosted: Sun Jul 01, 2007 9:48 am    Post subject: i see, but

i see, but that code only for phpbb, i'm now looking for a mod rewrite script that can limit connect to my site Like i want only give 3 connect at same time to acb.com at 1 Ip. and if i have a music file that locate at acb.com/file.mp3 then i want only play in mysite at abcd.com and no other site can play, and people cannot direct type it in the browse or use internetdownloadmanager, flashget or any programes to download it direct. It's only download by right click at download in my playing box. Thanks
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14854

How to protect media file using mod rewritePosted: Sun Jul 01, 2007 11:35 am    Post subject: Re: How to protect media file using mod rewrite

The .htaccess is not meant for phpBB only :

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www\.example\.com/.*$ [NC]
RewriteRule \.(gif|jpg|mp3)$ http://urltoshow.com/imagetoshow.jpg  [R,L,NC]


But this will only make sure the request was referred from your site, and empty referrers will be allowed.

To be more accurate, I think you should use php, for example checking a cookie or a logged in status before you send the file to read.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
huyhoa



Joined: 02 Dec 2006
Posts: 9

How to protect media file using mod rewritePosted: Mon Jul 02, 2007 6:29 am    Post subject: thanks

Thank you so much.
I have 1 more question, please help me:
my all file are locate in folder like abc and extension is .wma
Now i want rewrite this all .wma to .txt and when post new music, i just put .txt file in input file. Please help me.
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14854

How to protect media file using mod rewritePosted: Tue Jul 03, 2007 2:27 pm    Post subject: Re: How to protect media file using mod rewrite

The code suggested will only block access to *.gif, *.jpg and *.mp3 when the http referrer is not your domain, or if it is empty (this to allow legitimate access for users behind strict firewalls).

You can add the *.wma support using :

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www\.example\.com/.*$ [NC]
RewriteRule \.(gif|jpg|mp3|wma)$ http://urltoshow.com/imagetoshow.jpg  [R,L,NC]


It's not 100%, but nothing will since it's always possible to at least capture video and sound from a web page, but it will make it really annoying for others to use your content on other domains.

Rewriting *.wma to *.txt like you suggest would not change much since this would mean to use mod_rewrite to rewrite *.txt to *.wma, for the *.txt files to work properly.
So, one could as well use you *.txt file link where he wants. It would only confuse bots a bit, and the problem is how legitimate ones would behave in front of huge txt files with meaningless content.

If you really want to protect you files, not the content since it can be captured, you'll need to use some script. The script could perform some checks, like a session check, before it would output or not the file's content.

readfile() is handy for this, and mod rewrite could here keep the *.wma links, rewriting them to your script.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
huyhoa



Joined: 02 Dec 2006
Posts: 9

How to protect media file using mod rewritePosted: Wed Aug 08, 2007 4:26 pm    Post subject: thanks

i just try this:
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www\.mydomain\.com/.*$ [NC]
RewriteRule \.(gif|jpg|mp3|wma)$ http://mydomain.com/error.jpg  [R,L,NC]

It's working
But when i using wma file to listening online, it dont play.
Please help me, i think when play online, windowmedia listening other post 80 so, it will show the error file.
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14854

How to protect media file using mod rewritePosted: Sun Aug 12, 2007 10:17 am    Post subject: Re: How to protect media file using mod rewrite

You can disable anti hot linking for .wma files :
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www\.mydomain\.com/.*$ [NC]
RewriteRule \.(gif|jpg|mp3)$ http://mydomain.com/error.jpg  [R,L,NC]


Or try somtehing like :

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !(mydomain\.com) [NC]
RewriteRule \.(gif|jpg|mp3|wma)$ http://mydomain.com/error.jpg  [R,L,NC]


A bit more opened this way, should allow listening on all sub-domains and ports.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: