I have educate yourself on many Pressure WWW. methods using htaccess. (As Below)

Rewritecond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) http://www.domina.com/$1 [R=301,L]

I am wondering if there's a means to pressure WWW using httpd.config over the entire site.

The htaccess works a goody, however i have numerous subdirectories, many of them include there own .htacess files, which breaks the pressure www for the reason that particular subdirectory.

So I believed, it is possible to method to pressure this "www." into httpd.config, over the entire site without editing .htaccess?


This works best for me

# direct all variation of FQDN to www.epoch.co.il
  RewriteEngine on

  #RewriteLogLevel 3
  #RewriteLog "/var/log/httpd/epoch/www/epoch-rewrite_log"

  RewriteCond %{HTTP_HOST}   !^www\.epoch\.co\.il [NC]
  RewriteCond %{HTTP_HOST}   !^$
  RewriteRule ^/(.*)         http://www.epoch.co.il/$1 [L,R]

This will get it done:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

And also to maintain HTTPS too:

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]