go to content | go to menu | skip to language menu


Redirect from non www to www

Data:
29 September 2009
Kategoria:
Server side, Skrypty
Author:
Cezary Tomczyk

If Your server ww is on Apache then redirect from nowwww address to address with prefix www is simple:

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteBase /
  4. RewriteCond %{HTTP_HOST} !^www\.
  5. RewriteCond %{HTTPS}s ^on(s)|
  6. RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  7. </IfModule>

Of course, this will work with http and https connections.

Next or previous post

Leave a Reply

(required)
(required)




Search