htaccess mask dynamic url with a static url
Posted
by Enkay
on Stack Overflow
See other posts from Stack Overflow
or by Enkay
Published on 2009-08-05T23:09:16Z
Indexed on
2010/03/17
2:01 UTC
Read the original article
Hit count: 573
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
© Stack Overflow or respective owner