I have created a simple CMS in which each article has an id, title, alias (for URL), introtext, fulltext, etc. as:
create table articles (
id int auto_increment primary key,
title varchar(80),
alias varchar(80),
introtext text,
fulltext text,
published tinyint(1),
date date
)
To access an article using the ID is easy and the URL will look something like:
www.mysite.com/article?id=31
or perhaps www.mysite.com/article?menuid=3&id=31
In my database the article looks like:
id: 3 title: This is my life alias: this-is-my-life introtext: yadda ... yadda
The goal is to take the alias field and use it to create a people-friendly URL as:
www.mysite.com/this-is-my-life.php
or
www.mysite.com/index.php?article=this-is-my-life
or
www.mysite.com/?article=this-is-my-life
In any case the article id is used to obtain the alias from the table and the alias becomes the basis of the people-friendly URL.
I see this regularly done in CMS like Joomla and Wordpress, perhaps even zen-cart. The question is how do you accomplish this with a PHP script or redirect function in the .htaccess?
New information (Jan. 23)
We seem to be talking apples to oranges as I am not understanding how this is supposed to work. Perhaps a link to a simplified demo site where you can see the menu ID structure in action will help.
This is slightly more complicated than the initial example but follows the same general idea. The live demo is based upon using the joomla menu manager to create the menu item including the URL and the optional alias. it looks like:
www.dottedi.us/test/index.php?option=com_k2&view=item&layout=item&id=5
Joomla and probably the other CMS systems (Wordpress, Drupal, etc) has a global configuration parameter to enable what they call SEO-friendly URLs. I call them people-friendly. It would take the above URL and convert it to the people friendly version employing the alias field from the table so the above URL would become
www.dottedi.us/test/about.php (with or without the .php suffix)
Rather than use the link field as the visible URL I could use the alias field so that it will look like about.php when you hover over it, but I am confused how to make it return the live URL. You can see this at:
I added some debugging output which you can see if you scroll to the bottom of a page. Does this help?