November 23rd, 2012, 03:34 AM
Changing the URL
I am displaying youtube videos in our site. When the user clicks on on a song , the song opens in new tab and it's URL is (domainname/video.php?id='videoid'
I want this url to be displayed as (domainname/song name
and that song name is nothing but the video title given by youtube. 'videoid' is dynamic and hence song name will be dynamic.
How to accomplish this?
November 23rd, 2012, 09:08 AM
Well, the item you'll wanna do some research on is mod_rewrite. This is Apache's URL Rewriting module that will accomplish just what you are looking to.
This was just a quick link from a Google search:
November 23rd, 2012, 10:04 AM
Mod_rewrite is the answer, but note that you'll still need to include the song's ID in the URL, much like the thread ID is in this URL. The song name is just going to be decoration since song names aren't unique.
You need to change your server to accept URLs in this new format and mod_rewrite them to your old format.
Then you need to re-write the links within your site to point to the new style of URLs.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.