View Full Version : Please help: In my link the http:// are doubling up !

02-15-2010, 04:41 PM

I am trying to construct a link and when I do keep getting a relative
link instead of the url.

This is my code:

<?php $the_file = 'creative_thinking.mp3'; echo "<a href=\"".urlencode(makelink($the_file))."\">Better-Creative-Thinking.mp3</a>"; ?>

The link shows up as:

http://www.mysite.com/sub-dir/https://my-bucket.s3.amazonaws.com/my-file.mp3?acesskey=hfllghlgflshgsl ...

of course it should not include the relative path but start off with the https.

like this

How can I get it to drop the relative part ?

I thought is was automatically detected when it starts with "http" ?


02-15-2010, 04:49 PM
What does the makelink function look like
You shouldn't be urlencoding the whole URL either, just the uri at the most

02-15-2010, 07:54 PM

The makelink() builds up the link,
the last line is this:

$link = "https://{$bucket}.s3.amazonaws.com/{$file}?{$authentication_params}";

I am using a similar link to play a video using a player,

Maybe it is because the "://" are encoded and therefore the "https://" is not being recognised ?

So I need to take the $link and break it up ??

What do you think ?_


02-15-2010, 07:58 PM
remove the urlencode and see what happens

02-15-2010, 08:18 PM
Thanks, goog idea.

I'll give that a try :)