RewriteRule ^/$ /blog/ [R]
Hmmm. I think that rule is attempting to move the DocumentRoot to /blog/, rather than a basic redirect. That means that /foo.php would also get be redirected to /blog/foo.php, which you don't want.[/quote]
$ is an anchor; it means the pattern before it should be the last part of the string.
That is, http://example.com/ should redirect to http://example.com/blog/, but http://example.com/gallery/ should not, because /gallery/ does not match ^/$
/gallery/ matches ^/
/gallery/ matches /$
/gallery/ does not match ^/$
-- (the single slash in the pattern has to be both at the beginning and the end)
Same effect can be achieved RedirectMatch directive instead of a rewrite rule.
RedirectMatch ^/$ /blog/
But the RewriteRule cannot use ^/$ to match http://example.com/, because in .htaccess files the path is stripped from the string to begin with; http://example.com/ starts out zero-length, and to match a zero-length string, the pattern is ^$:
#Redirect only / to /blog/
RewriteRule ^$ /blog/ [R]
Perl / MySQL / HTML CSS