Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/124825-db-queries-and-mod_rewrite/
Share on other sites

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

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.