Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-16 15:03:23

apo
Member
From: Germany
Registered: 2004-10-27
Posts: 53

... make files not direct-linkable?

Is there a possibility to prevent files from being downloaded from a wrong referrer? I do not want my files to be directly linked by other websites…

Offline

#2 2006-01-16 16:21:10

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: ... make files not direct-linkable?

you are talking about deep linking .. no idea but htere should be scripts around. just google for deep linking…

Offline

#3 2006-02-04 17:09:15

apo
Member
From: Germany
Registered: 2004-10-27
Posts: 53

Re: ... make files not direct-linkable?

i cannot find anything that could help me. is this to be solved via apache, or is it a script thingy? isnt it better to implement such a feature directly into the file_download-script?

Offline

#4 2006-02-04 17:21:22

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: ... make files not direct-linkable?

This is not going to help you, but here is another thread about this…

Offline

#5 2006-02-06 09:25:55

neptho
Member
From: A cold, dark place.
Registered: 2006-02-01
Posts: 48

Re: ... make files not direct-linkable?

You should be able to modify the default rewrite rules that Textpattern uses. Note that the ‘L’ tells it to stop processing here, so if you put this BEFORE Textpattern’s default entries in .htaccess, it should just work (note that it has to be AFTER ‘RewriteEngine On’):

RewriteCond %{HTTP_REFERER} !^$ [OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?(mysite\.com)/.*$ [NC]
RewriteRule ^file_download/(.*)?$ http://www.mysite.com/files [R, L]

Offline

#6 2006-02-06 12:51:21

apo
Member
From: Germany
Registered: 2004-10-27
Posts: 53

Re: ... make files not direct-linkable?

wow, you helped me alot :-) i got it running now. in my case the following does the trick:

RewriteEngine On

<notextile># RewriteCond %{HTTP_REFERER} !^$ [OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?(mfkne\.de)/.*$ [NC]
RewriteRule ^file_download/(.*)?$ http://www.mfkne.de/files/deeplink.html [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php</notextile>

I had to comment the first rewrite condition out, because it didnt want my own site as referrer then too… though i got advised in another forum, that i should let empty referrers go through, because of firewalls, proxys and so on. but it didnt work…

further i took out the ®, but just for cosmetical purposes…

for testing you could try the following:

deeplink to mfkne.de/file_download/17
link to the corresponding article, so you can test the correct referrer

Last edited by apo (2006-02-06 12:52:35)

Offline

Board footer

Powered by FluxBB