What is the best practice for rewriting URLs with parameters in PHP for better SEO optimization?

When dealing with URLs that contain parameters in PHP, it is best practice to rewrite them to be more SEO-friendly. This can be achieved by using a technique called URL rewriting, which involves creating cleaner, more descriptive URLs that are easier for search engines to index. By rewriting URLs with parameters, you can improve the overall SEO optimization of your website.

```php
RewriteEngine On
RewriteRule ^products/([0-9]+)/([a-zA-Z0-9_-]+)$ product.php?id=$1&name=$2 [L]
```

In this example, the code snippet uses mod_rewrite in Apache to rewrite a URL like `example.com/product.php?id=123&name=example-product` to a cleaner URL like `example.com/products/123/example-product`. This not only makes the URL more user-friendly but also helps search engines better understand the content of the page.