05-03-2009, 04:18 AM
I have seen website written in php, wordpress is a good example, and they don't have ?id=11, instead they have an html file, or a folder.
I am a beginner at PHP, I have only written one script. I am about to write another script where people will be adding content such as videos from youtube. How can do I get /title-of-video.html instead of /video.php?id=11 (?)
05-03-2009, 04:29 AM
Well what you're looking for is mod_rewrite, often these 'clean urls' have an id at the end or start of it so it's not exactly "/title-of-video.html" it's more in the form of "/title-of-video-0142.html" and the "title-of-video" can be anything, it's the id at the end that matters.
Otherwise If you have seen it like you say, well then I'd expect that it searches the database for videos with that title but of course then you may have conflicts with the titles and hence why the most use id's in the url.
A quick google search can find you information about mod_rewrite, the trick part would be using regular expressions to write the condition again another search.
05-03-2009, 11:44 AM
Some CMSs like Wordpress use the title itself as the url, and there is an option to edit this entire url for our needs. In wordpress, they keeps an indexed varchar field named post_name to store the post title and then look up this table for serving the content.