I’ve moved a WordPress blog from oldsite.com/blog/ to newsite.com/ (the root directory). The blog itself transferred without a hitch, but I’m trying to write an .htaccess file to put at oldsite.com/blog that keeps all old links to the blog’s posts working. The idea is that http://oldsite.com/blog/anything redirects to http://newsite.com/anything. The current version, saved at http://oldsite.com/blog/.htaccess, reads this way in its entirety:
RewriteRule (.*) http://www.newsite.com/$1 [R=301,NC,L]
And that works for everything except one address: http://oldsite.com/blog <-- without the trailing slash. That URL will redirect to this: http://newsite.com//home/username/oldsite.com/blog.
As far as I can tell, when the URI lacks a trailing slash, the RewriteBase doesn’t work right, and it somehow interprets $1 as the full filesystem path of the directory, even though I’m not telling mod_rewrite to do that anywhere. I think I understand the problem, but no matter what I try–and I’ve tried literally dozens of things, for hours–I can’t get it to work. Can someone please help me?