How can mod_rewrite be used to modify URLs in PHP applications?

Mod_rewrite can be used in PHP applications to modify URLs by rewriting them to a different format. This can be useful for creating user-friendly URLs, redirecting old URLs to new ones, or implementing URL routing in MVC frameworks. By using mod_rewrite in conjunction with an .htaccess file, developers can easily manipulate URLs without changing the underlying PHP code.

RewriteEngine On
RewriteRule ^old-url$ new-url [L,R=301]