PDA

View Full Version : .htaccess help pls.



MrCraig
28-05-2008, 02:58 PM
Ok, im making a jukebox like thing, and for legal reasons, users wont be able to download or see the mp3 files.

Does anyone know the code to protect files in this directory with .htaccess?

Thanks :)

iUnknown
28-05-2008, 03:09 PM
An easier solution, CHMOD the directory/files to 770 (the user and group on the server can read, write and execute, but others/viewers cannot).

MrCraig
28-05-2008, 03:59 PM
Now the player cant access the files pmsl :P!

Tom H
28-05-2008, 04:17 PM
When putting links to your files don't make them global i.e yoursite.com/files/file.mp3 use the server link i.e /home/user/public_html/files...

MrCraig
28-05-2008, 04:32 PM
It is currently using server link :S

I dunno if its because of the fact that its a flash object the server link is being converted to a global link somewhere.

Moh
28-05-2008, 04:55 PM
You could disallow every IP from accessing it and then allow the server to access it?

MrCraig
28-05-2008, 06:46 PM
which would have to be done using .htaccess ?

And im sure ive saw it somewhere, just cant remember the code



Allow Deny All


Or something?

Independent
28-05-2008, 08:35 PM
which would have to be done using .htaccess ?

And im sure ive saw it somewhere, just cant remember the code



Allow Deny All
Or something?


<limit GET>
order deny,allow
deny from all
allow from localhost
</limit>

Dentafrice
28-05-2008, 08:38 PM
You can't deny everyone, as the flash object would have to connect to it, and the flash object connects to it via your IP.

MrCraig
28-05-2008, 08:49 PM
:S

So any more suggestions lol?

Independent
28-05-2008, 08:54 PM
:S

So any more suggestions lol?

Rewrite the Mp3 directories,
too something like lyrics.php?e=engine

So they get confused about stealing the mp3 ;]

MrCraig
28-05-2008, 09:07 PM
LOOOL.

Dont fink that wud work for some reason :P +REP anyways.
EDIT: Gotta spred :{

Independent
29-05-2008, 01:47 PM
LOOOL.

Dont fink that wud work for some reason :P +REP anyways.
EDIT: Gotta spred :{
But try confuse the visitor to the URL - since you can't block them, not even myspace can block the MP3's from being downloaded, and their player look's pretty well coded.

Luke
29-05-2008, 02:26 PM
you could use php...



<?php

// get-file.php
// call with: http://domain/path/get-file.php?id=1

$id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1";

// lookup
$url[1] = 'http://domain/path/music_01.mp3';
$url[2] = 'http://domain/path/music_02.mp3';
$url[3] = 'http://domain/path/music_03.mp3';
$url[4] = 'http://domain/path/music_04.mp3';

header("Location: $url[$id]");
exit;

?>

so set the URL's

then use

http://domain/path/get-file.php?id=1

And it would go to

http://domain/path/music_01.mp3

-Luke

MrCraig
29-05-2008, 02:45 PM
Ye but then a user could easily type the get-file.php?id=1 and still access the music so theres no real point lol :P

Want to hide these adverts? Register an account for free!