Say I wanted http://domain.com/product/?id=123
to become http://domain.com/product/foo
, how do I do that in .htaccess
? I tried something like this, but it didn't work:
RewriteBase /fisher
RewriteCond %{QUERY_STRING} ^id=123$ [NC]
RewriteRule ^/product$ /product/foo [NC,L,R=301]
Suggestions?
NOTE: I do not need to capture the value of the id
parameter as I will not use it in the new URL.
UPDATE 1:
RewriteEngine On
RewriteBase /fisher
RewriteCond %{QUERY_STRING} ^id=123 [NC]
RewriteRule ^product/$ /product/foo [NC,L,R=301]
- Showing RewriteEngine and RewriteBase
- Remove
$
in RewriteCond - Remove
/
in RewriteRule
When I go to http://localhost/fisher/product/?id=123
, nothing happens. The URL remains the same.