Using mod rewrite with a database

Hi Everybody,
Not sure if this is the correct section, but I guess somebody will be able to help.

Basically, I’m trying to make search engine friendly URLS, so I plan an using the following format

Is there a for me to do this using mod rewrite? The category will be different for a lot of links, as will the item-name and item-id. Basically, I want a way of sending all URLS in this format to a file called displaydetails.php, I guess I can then parse the URL and display the information I want to display.

Also, I will use URLS like , which will display all items in a category, a user can click on a link there that will display like the link above.

Does anybody know the entry I need to place in my .htaccess to achieve this?

Thanks in advance


Sorry, that looks like a “code for free” (script kiddie) request. On the assumption that this is NOT what you’re asking, may I suggest that you read the mod_rewrite tutorial linked in my signature. That will lead you through how to create the regex you need AND provide coding examples. If you still need help, PLEASE come back and show the code you’re attempting as well as the test URI you’re attempting to convert (BACK to what Apache can serve). I am here to help members LEARN and will talk you through it so that you KNOW what your code is doing.



Hm, I dunno, doesn’t this sound like what WordPress does? Sends just about everything to a script that gathers together the correct page based on the params in the url?

My husband recently made a site with the Catalyst framework, so there is zero mod_rewrite going on, because Catalyst is building the url based on what it finds as it picks out the correct request out of the database. So, currently a downside is if you were at and wanted to see all the other similar items, just going back to doesn’t bring up a list of those items. I think this is a fault and I’m sure it can be fixed, but that’s one version of database-driven sites. Apache is doing very little there.