|
-
Sep 30th, 2007, 05:12 PM
#1
Thread Starter
WiggleWiggle
Rewritting URLs
I am creating a videos page, and i need to display a video on the page, but i dont want to put the actual URL to the video. I want something like:
mysite/video.php?14323
and it will somehow rewrite the url in video.php to show the video... any thoughts on how to do this?
My usual boring signature: Something
-
Sep 30th, 2007, 07:14 PM
#2
Re: Rewritting URLs
you mean, somthing like i have don here ?
http://youtubehits.freehostia.com/
Last edited by Fazi; Sep 30th, 2007 at 07:20 PM.
-
Sep 30th, 2007, 09:59 PM
#3
Thread Starter
WiggleWiggle
Re: Rewritting URLs
no. I need the video.php page to load the video
My usual boring signature: Something
-
Sep 30th, 2007, 11:44 PM
#4
Re: Rewritting URLs
so dclam
You want to give the url like this
I have given like this youtubehits.freehostia.com/index.php?topic=google_earth
what is the diffrent between us?
-
Oct 1st, 2007, 04:26 PM
#5
Thread Starter
WiggleWiggle
Re: Rewritting URLs
I think i explained wrong. I am embedding songs/videos on my website and i dont want the actual URL of the media to show, so i want to some how play it through another url.
Ex: here is the actual url of a file:
http://www.mysite.com/path/to/file.mp3
instead of showing that in my source, i want to show:
media.php?id=some_rand_hash
and in media.php, it does a mysql lookup, gets the actual url, and plays it... somehow.
I am going to try something with Headers...
My usual boring signature: Something
-
Oct 11th, 2007, 12:09 PM
#6
New Member
Re: Rewritting URLs
Code:
<?php
$id = intval($_GET['fileid']);
// look up the file where id = $id
$file_path = get_file_path($id);
// perhaps set your mime-type here based on the file extension
// header("Content-type: audio/mpeg");
readfile($file_path);
?>
readfile will stream the file out for you, so http://yoursite/file.php?fileid=2 would return the file stream as if you requested it directly from the filesystem.
make sure you send the content-type in the header too. some browsers need this or else it won't display your youtube video, image, or mp3 file. you can base that off of you file extensions (ex: me.mp3 translates to "Content-type: audio/mpeg" and a png image would be "Content-type: image/png").
Last edited by Mad-Hatter; Oct 11th, 2007 at 12:14 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|