What are the best practices for structuring mod_rewrite rules in PHP to avoid conflicts and ensure proper functionality?

When structuring mod_rewrite rules in PHP, it is important to organize them in a logical order to avoid conflicts. One common practice is to place more specific rules before general ones to ensure proper functionality. Additionally, using comments to explain each rule can help with readability and troubleshooting.

RewriteEngine On

# Specific rule for a certain page
RewriteRule ^specific-page$ specific-page.php [L]

# General rule for all other pages
RewriteRule ^(.*)$ index.php?page=$1 [L]