How do I make it so all traffic is directed for the entire site and all subdirectories from non-www to www.

Here is my .htaccess contents:

RewriteEngine on

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/vivalast
<Files php.ini>
order allow,deny
deny from all

RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ "http\:\/\/www\.example\.com\/$1" [R=301,L]
  • Please ensure you read rules before continuing to post unnecessary duplicates. Oct 13, 2013 at 20:15

1 Answer 1


Try this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC]

Not the answer you're looking for? Browse other questions tagged or ask your own question.