Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
</Files>
</IfModule>

RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ "http\:\/\/www\.example\.com\/$1" [R=301,L]
share|improve this question

marked as duplicate by Zistoloen, Simon Hayter Oct 13 '13 at 20:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Please ensure you read rules before continuing to post unnecessary duplicates. – Simon Hayter Oct 13 '13 at 20:15

Try this:

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

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