Here is an example from the Apache documentation for enforcing canonical hostnames:
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]
What I would like to know is why the /? is needed. I've tried removing it and everything appears to work the same. I was under the impression that the pattern part of the rewrite rule was compared against what comes after the slash.