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

    Join Date
    Nov 2012
    Rep Power

    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
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Hartford, WI
    Rep Power
    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:
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Pennsylvania, USA
    Rep Power
    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