I've checked quite a few tutorials on mod_rewrite but i'm still confused. If i create a .htaccess file with a mod_rewrite rule to redirect the page http://www.example.com/how-to-do-this to http://www.example.com/index.php?id=10 Do i need to lookup the id for the post 'how-to-do-this' posted as a query string from the mod-rewrite rule in index.php and load the corresponding blog post? Also what will happen if i have 2 blog posts with the same title? Can somebody shed some light please?
You can rewrite the URL to this instead example.com/10/how-to-do-this or example.com/10-how-to-do-this This way you can get the ID and don't have to worry about anything else.
or you can even rewrite http://www.example.com/how-to-do-this to http://www.example.com/index.php?title=how-to-do-this and then lookup in database for the title. Obviously your blog must generate unique titles or use a separate field for titles to be used in URL. Above examples are safer, though. http://www.example.com/how-to-do-this might screw up other URLs unless you are careful.