I am working on a site and learning PHP at the same time so it is relatively new to me. I am working on URL rewrite currently, however, I am not getting the desired result.
I am trying to change: example.com/CMS/listing?id=1 into example.com/CMS/listing/1.
Using the .htaccess file held in the root of the files, I have the following:
RewriteEngine On
RewriteBase /
RewriteRule CMS/listing/([0-9]+) CMS/listing.php?id=$1
And on the site, I have a simple echo function which gets the query string param for id. When I navigate to example.com/CMS/listing?id=1 the function displays 1, however, when I go to example.com/CMS/listing/1 it does not show anything. Is there something I'm missing or doing wrong?
# Get QString Param
$id = $_GET["id"];
echo $id;
Footnote
.htaccess is held at the root, and listing.php is within a folder called CMS.