What are the best practices for passing parameters in mod_rewrite rules in PHP?

When passing parameters in mod_rewrite rules in PHP, it is best practice to use the `QSA` flag in order to append the query string to the rewritten URL. This ensures that any existing query parameters are preserved. Additionally, it is important to properly sanitize and validate any user input to prevent security vulnerabilities.

RewriteEngine On
RewriteRule ^products/([0-9]+)/?$ product.php?id=$1 [QSA]