I am trying to use apache-rewrite rule to convert the below URL:
http://localhost/foo/bar/news.php?id=24
Into this
Change the link:
echo " ". substr($row['title'], 0,26)."
to
echo "".$row['title'].""
That way, the link will go to news/$row['title']
instead of news.php?id=...
. And now in the page DIRECOTORY/AID/news.php
, you should get the id
and check if it is a number OR text, and in case of text match it up with the $row['title']
and then load the page accordingly.
Notes:
If the title is not going to be unique then you should probably do news/{id}/{title}
and then in rewrite it to DIRECTORY/AID/news.php?id={id}&title={title}
and then you can base it off of the ID instead of the title.
Hope that helps.