How does using mod_rewrite for language selection in URLs impact SEO for websites with multilingual content in PHP?

When using mod_rewrite for language selection in URLs for websites with multilingual content in PHP, it is important to ensure that the URLs are SEO-friendly and properly redirect to the correct language version of the page. This can be achieved by setting up rewrite rules in the .htaccess file to handle language parameters in the URL and redirecting to the appropriate language version of the page based on the user's preference or browser settings.

RewriteEngine on

# Redirect to language-specific URLs
RewriteRule ^en/(.*)$ $1?lang=en [L,QSA]
RewriteRule ^fr/(.*)$ $1?lang=fr [L,QSA]