Search code examples
phpmysqldatabasepermalinks

How do I create permalinks that are database driven?


I'm looking for a way to translate

http://www.mysite.com/articles.php?id=1

into

http://www.mysite.com/articles/name_of_article_from_field_in_database_with_id_1

I'm ok with doing some sort of RewriteRule with Mod Rewrite, but I'm not sure how to do it exactly. My pages are coded in PHP pulling from a MySQL database.

Hopefully someone can tell me how to do this!

I know there are others looking for a similar answer.

Thanks again!

NCoder


Solution

  • You're going to need a rewrite rule in your web server configuration to translate e.g. /123 to /index.php?id=123 - it's not a PHP issue per se.