Skip to main content
Inspiring
November 17, 2008
Question

URL rewriting to include title text

  • November 17, 2008
  • 1 reply
  • 583 views
I run a magazine website, and we have all of our articles online. I'm looking for a way to include the title of the magazine article in the URL, so instead of:

http://www.mymagazine.co.uk/view.cfm?id=256&issue=170

I'd like
http://www.mymagazine.co.uk/view.cfm?This_is_the_name_of_the_article

I can't seem to find information about this anywhere... Our websites are hosted on a shared server, no sure if that makes any difference..
    This topic has been closed for replies.

    1 reply

    November 17, 2008
    You pass the "id" bit to find the article right? This id therefore is UNIQUE to the article. No other article will have that id...and rightly so!

    One solution you could use is to drop the use of the id, and use the title as the unique identifier. This is more risky for security purposes (URL hacking etc) but with the right sort of validation on the string there'd be no reason you couldn't do this. One thing to note however, you'd then not be able to have two articles named the same thing. So, on creation of a new article, you'd have to check if one is already named that in the database.

    OR, you could just carry on the same way but append the title to the end. It wont be used to retrieve the article, and may not be required, but they are extra words a search engine could pick up on. e.g:

    http://www.mymagazine.co.uk/view.cfm?id=256&issue=170&title=my_article_title_here

    Good luck!
    Mikey.
    Inspiring
    November 17, 2008
    Thanks! - I'm annoyed i didnt think of that myself though :(

    Katie