#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    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?

    Please Help...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    722
    Rep Power
    7
    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:
    http://www.sitepoint.com/guide-url-rewriting/
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    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.

IMN logo majestic logo threadwatch logo seochat tools logo