RAD!S Posted July 14, 2010 Share Posted July 14, 2010 Hello everyone! I'm new here and I hope you'll help me find a solution to my problem! I have written a blog in php, and all my articles are identified with their id number. So if anyone wants to see a particular article, he clicks on a link that opens mysite.fr/view.php?nArticle=9 for example. I'd like to rewrite it so that it is prettier, but i don't want to have mysite.fr/view/9 because I don't want the user to see the number at all. I have seen that wordpress blogs write in their url the title of each article. So that's my question : can I make a request to my database, get the article title, and rewrite the url so that it is mysite.fr/name_of_the_article ? I have searched the web and this forum but haven't found... Everyone talks about .htaccess files but I thinks that in order to question my DB I have to write it in the view.php file... Thanks in advance ! Quote Link to comment https://forums.phpfreaks.com/topic/207693-mod_rewrite-with-mysql/ Share on other sites More sharing options...
RAD!S Posted July 14, 2010 Author Share Posted July 14, 2010 I have found a solution! I have added a field in my database "urlname", and every article has its unique url name The links now refer to view.php?name=blabla And I just have to rewrite it ! Thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/207693-mod_rewrite-with-mysql/#findComment-1085738 Share on other sites More sharing options...
vijdev Posted November 14, 2010 Share Posted November 14, 2010 i would still like to see: mysite.fr/articles/name_of_the_article instead of: mysite.fr/articles.php?name=name_of_the_article or mysite.fr/articles.php?num=9 or view.php?name=blabla (from db point of view basically article id number will have an article title linked to it in the same row...) can anyone help? RAD!S solution "works", but not what am looking for! Quote Link to comment https://forums.phpfreaks.com/topic/207693-mod_rewrite-with-mysql/#findComment-1134025 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.