Help with URL Rewrite
Posted
by
bodesam
on Pro Webmasters
See other posts from Pro Webmasters
or by bodesam
Published on 2012-07-04T09:40:52Z
Indexed on
2012/07/04
15:24 UTC
Read the original article
Hit count: 196
This is the first time i'm doing this and have been doing some research on it.
I have a page that selects some info from a database and displays it with a link to a second page that uses the result to query the database, something like this:
$sel=mysql_query("select id, title from thetable ");
while($row=mysql_fetch_array($sel))
{
$id=$row['id'];
$title=$row['title'];
echo "<a href='more.php?id=$id'>$title</a>";
}
The issue is, in the more.php page, instead of more.php?id=5 to show in the address bar, I want something like more/title
Secondly, as it obtains in most sites, I want the link on the referring page to show this friendly url on mouse hover not the more.php?id=5
And I notice in most sites some words like 'a', 'and', 'the' etc are usually removed from the url title(even if there originally), moreover how does one handle the situation where more than one record have the same title.
How does one go about achieving this url rewrite with htaccess or whatever method is used.
Thanks.
© Pro Webmasters or respective owner