ebekulak Posted September 18, 2008 Share Posted September 18, 2008 I'm not sure whether I should post it under SEO section or mod_rewrite, so please correct me/move the post if this is not exactly the correct place. OK, I'm new to the mod_rewrite and SEO stuff, I've been playing around a little and I think I got some stuff sorted but here is my problem, I use links such as; http://www.mydomain.com/index.php?mid=2&contentId=27 I've found various ways to make it look like http://www.mydomain.com/index/mid/2/contentId/27 but I want it to look like; http://www.mydomain.com/lifestyle/best-cafes.html see, the "mid" stands for the category name and "contentId" stands for the article. A friend of mine said I should use a connection table in the database, but frankly I dunno how to walk in that road. Any help or simply pointing out a good tutorial is appreciated. many thanks in advance! ps: I'm a complete noob at regular expressions Quote Link to comment https://forums.phpfreaks.com/topic/124825-db-queries-and-mod_rewrite/ Share on other sites More sharing options...
JonnoTheDev Posted September 18, 2008 Share Posted September 18, 2008 If you wat to remove the numeric ID values from the URL you have a few options: 1. Use a RewriteMap (research this) 2. Edit your script to use the title as the lookup instead of the numeric ID 3. Edit your script to use a title to ID map i.e. an array that has all titles as the key and the ID as the value. You can then return the ID from the array via the title to perform your lookup It is however easiest to keep the numeric ID contained within the URL Quote Link to comment https://forums.phpfreaks.com/topic/124825-db-queries-and-mod_rewrite/#findComment-644845 Share on other sites More sharing options...
ebekulak Posted September 19, 2008 Author Share Posted September 19, 2008 thanks for the tip neil, I've been researching on RewriteMap, feeling my brain turning into marshmallow but I guess that's a positive sign, eh? I will keep the second and third option as a last resort in case I turn out to be too dumb to work around RewriteMap. Just one question, is it me or is there a really huge lack of tutorials and documentation for using RewriteMap with php/mysql? Quote Link to comment https://forums.phpfreaks.com/topic/124825-db-queries-and-mod_rewrite/#findComment-645487 Share on other sites More sharing options...
JonnoTheDev Posted September 19, 2008 Share Posted September 19, 2008 Mod Rewrite is not really associated with PHP. It is an apache module that uses PERL regular expressions. Mod Rewite is a subject in itself with a variety of uses for HTTP requests. Quote Link to comment https://forums.phpfreaks.com/topic/124825-db-queries-and-mod_rewrite/#findComment-645508 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.