What is the purpose of using Mod_Rewrite in PHP and how does it affect URL structure?

Mod_Rewrite in PHP is used to rewrite URLs in a more user-friendly and search engine-friendly manner. It allows developers to create clean and readable URLs that are easier for users to remember and understand. This can improve SEO rankings and make the website more user-friendly.

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