What potential security risks should be considered when using mod_rewrite and htaccess in PHP for URL rewriting?

One potential security risk when using mod_rewrite and htaccess for URL rewriting in PHP is the possibility of creating open redirects, which can be exploited by attackers to redirect users to malicious websites. To mitigate this risk, it is important to validate and sanitize user input before using it in rewrite rules.

RewriteEngine On
RewriteCond %{QUERY_STRING} ^url=(.*)
RewriteRule ^(.*)$ %1 [R=301,L]