htaccess mask dynamic url with a static url
- by Enkay
I'm trying to do something with .htaccess that I'm not sure can be done.
First thing I did is hide the .php extensions using the following code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Works great.
Now what I'm trying to do and can't seem to figure out is the following:
When a user types "mywebsite.com/products?id=12345" into the browser address bar, I want the server to serve the right product page according to the ID but display it in the address bar as "mywebsite.com/product" no matter what the product ID is.
Is this possible to do? If yes how?
Thanks