Reputation: 633
Im redirecting example.com/dir/anypage.html to www.example.com/dir/anypage.html (same page).
I have the following in .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [nocase]
RewriteRule ^(.*) http://www.example.com/$1 [last,redirect=301]
However is not redirecting (the home page) example.com to http://www.example.com
Im missing something?
Upvotes: 0
Views: 30
Reputation: 81
Try this
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Upvotes: 1