What are some best practices for configuring the .htaccess file to achieve clean URLs in PHP?
When working with PHP, it is common practice to use clean URLs for better readability and SEO optimization. One way to achieve clean URLs is by configuring the .htaccess file to rewrite URLs internally. This can be done by using mod_rewrite rules to redirect requests to a specific PHP file that handles the routing logic.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]