Rewrite URL with php variables using .htaccess

Avatar
  • Answered
Is there a way i can rewrite urls using htaccess in a way that when i have a URL like example.com/products.php?prod_id=1&status=active to show example.com/products/prod_id/status in the url but allow the php code to read exactly the same URL while processing
Avatar
Scott
Hello cracker,

Thank you for your question on creating 301s with variables. You cannot create 301s using query string parameter.

You can use the QUERY_STRING method> an example is below:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=123$
RewriteRule ^/?product\.php$ http://domain.com/product_123.php? [L,R=301]

Kindest Regards,
Scott M

Kindest Regards,
Scott M