Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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} ^$
RewriteRule ^(.*)$ "http\:\/\/www\.domain-name\.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

1 Answer 1

Try this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [R=301,NC]
share|improve this answer

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