What is the purpose of using mod_rewrite in PHP and what are some common applications?

Mod_rewrite in PHP is used to rewrite URLs, allowing for more user-friendly and search engine-friendly URLs. It can be used to redirect URLs, rewrite URLs based on certain conditions, and mask the actual URL of a resource. Common applications of mod_rewrite include creating clean URLs for websites, redirecting old URLs to new ones, and implementing URL routing for web applications.

RewriteEngine On
RewriteRule ^about$ about.php [L]
RewriteRule ^contact$ contact.php [L]