What is the best practice for implementing search engine optimized URLs in PHP?

When implementing search engine optimized URLs in PHP, it is best practice to use clean, descriptive URLs that include relevant keywords related to the content of the page. This can help improve search engine rankings and make it easier for users to understand the content of the page from the URL alone.

// Example of implementing search engine optimized URLs in PHP
// Rewrite rule in .htaccess file
// RewriteRule ^products/([a-zA-Z0-9_-]+)$ product.php?id=$1 [NC,L]

// PHP code to handle the rewritten URL
if(isset($_GET['id'])) {
    $productId = $_GET['id'];
    
    // Use $productId to fetch and display the relevant product information
}