RewriteRule: Unable to redirect from 'foo.com' to 'www.foo.com'
using htaccess
guarriman
8:38 am on Sep 11, 2007 (gmt 0)
Hi.
This is my piece of code within my '.htaccess' file: --------------- RewriteEngine On RewriteCond %{HTTP_HOST} [foo.com...] RewriteRule ^/(.*) [foo.com...] [L,R=301] -----------------
The HOST should include only the name, not the http:// preamble. The added NC makes it case insensitive.
If the code is going in .htaccess then RewriteRule cannot see the leading / on the requested path. If the code is going in httpd.conf, then it can see the leading / there.
Escape the literal period in the HOST part. The example in the post immediately above, is all good.