RE: .htaccess - how to force "www." in a generic way?

I requested this before, and also got this answer:

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

It really works, but now i'm seeing 301 Moved Permanently within the response headers. I wish to get rid of the 301s. May be the problem the second rewrite condition? If it is something similar to "doesn't begin with 'www.' then the host title"?

Incidentally, I would like this solution to dedicate yourself any server (meaning, I'd rather not hard code my domain title).



I simply recognized the above isn't working properly. Basically possess the following:

I'm not going that to alter to:

I'm not going this affecting sub-domain names. I only would like it to affect missing www.

Redirecting to another domain is as simple as definition difficult without some header redirect. If you would like the URL within the user's browser to alter, you need to pressure a brand new request. There's not a way around that.

You'll have to take your pick - the 301, 302 and 303 status codes being probably the most easy options.