How can PHP code be optimized to handle URL rewriting for search engine friendliness?
To optimize PHP code for URL rewriting for search engine friendliness, you can use mod_rewrite in Apache to rewrite URLs to a more user-friendly format. This can help improve SEO by making URLs more readable and descriptive to search engines.
RewriteEngine On
RewriteRule ^products/([0-9]+)/?$ product.php?id=$1 [NC,L]