How can one troubleshoot issues with mod_rewrite in PHP when rewriting URLs?

When troubleshooting issues with mod_rewrite in PHP when rewriting URLs, ensure that the mod_rewrite module is enabled in your Apache server configuration file. Check the syntax of your RewriteRule directives in the .htaccess file to ensure they are correct. Additionally, make sure that the AllowOverride directive is set to All in the Apache configuration file for the directory where the .htaccess file is located.

RewriteEngine On
RewriteRule ^old-url$ new-url [L]