Maaz
Maaz

Reputation: 4303

Make custom URLs for files to hide their location

So I'm using the jQuery File Upload plugin to stream videos on my site. I'm just having a bit of problems.

So I've created a database that stores some of the details of the video that is uploaded, example: size, random and unique id, description, and some other things.

Now, I want to create a page for each video that is uploaded. I can easily do this through a .php file that just grabs the file location, and so on. However, how can I make it so that when users try to access a specific video they can type in something like this in the url

mysite.com/video/random_video_id

Then grab the random_video_id from the URL and use it in my PHP script to display necessary content on the page.

I just want to know how I can make custom urls like mysite.com/video/random_video_id that will trigger the php script that will generate the content of the page.

Upvotes: 0

Views: 139

Answers (1)

Rasmus P
Rasmus P

Reputation: 176

you need to use .htaccess for making the pretty url you want use...

if you make a url mysite.com/index.php?action=video&id=random_video_id ... I assume you know how you use $_GET and basic PHP, so I wouldn't go into the coding of the script which retrieves the videoes...

I use this site to make my .htaccess files - http://searchfriendlyurls.com/

And then you just write your domain in the first input (Domain Name) and in the second (ugly url) you write "index.php?action=&id=" and in the last (pretty url) you write "/"

Hope this helps you ...

And if you want to learn more about .htacces look here

Upvotes: 1

Related Questions