views:

77

answers:

3

I have a build a web portal based on the Cricket concept, I have build a Custom based CMS where I can upload the News for the site

Once I upload the news, the URL Will be like this http://cricandcric.com/news/news.php?id=841&An-emotional-moment:-Dhoni.html

But I am trying to have the above Url as follows (some thing like this) http://cricandcric.com/news/An-emotional-moment:-Dhoni.html

Or similar to Stackoverflow.com,

Can any one please help me how can i build that? Do I need to rewrite the URL ?

+1  A: 

Yes, this is typically done with URL rewriting. This is a great intro to it.

Note that you'll have to make sure that the titles are unique, if you're removing the ID from the URL. (And you might as well get rid of the ".html" too)

Chad Birch
A: 

Yes, as far as I can see you need to rewrite the URL. The URL "http://cricandcric.com/news/An-emotional-moment:-Dhoni.html" might be rewritten to "http://circandcric.com/news/index.php?title=An-emotional-moment:-Dhoni". Then, index.php has to figure out the correct news item from this title. This might be a source of problems (transformation of the title into URL-compatible string and back again), and, as Chad pointed out, the title has to be unique. If you get into trouble, check out how Stackoverflow handles this (ID as part of the URL, then title).

Tom Bartel
@Tom, this is really helpful information for me to produce, Thanks
harigm
A: 

yeah Dude, .htaccess file will resolve all your Riddles.....Chk This--- How to use .htaccess file for rewriting URL?

OM The Eternity