What are the best practices for handling URL redirection in PHP using htaccess?
When handling URL redirection in PHP using htaccess, it is important to set up proper rules to redirect URLs efficiently and maintain SEO rankings. One common practice is to use 301 redirects for permanent redirection and 302 redirects for temporary redirection. Additionally, ensure that the htaccess file is properly configured to handle the redirection rules effectively.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/old-url$
RewriteRule ^(.*)$ /new-url [R=301,L]