What is the purpose of URL rewriting in PHP?

URL rewriting in PHP is used to make URLs more user-friendly and easier to read. It allows you to transform dynamic URLs with query strings into static-looking URLs. This can improve SEO, make URLs more memorable, and enhance the overall user experience on a website.

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