Generic .htaccess redirect non-www to www (apache)

I remember to have this note somewhere, but always lose it for some random reason.

So here you go :

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Source : Stack Overflow

Share Button

Published by

Rinaldo Jonathan

Admin of this site. Artis papan PCB. #zoneRinaldo #Controllerism Studio Demon, Stage Angel, Sleepy Developer, Smoke free. Kalkud SHS 2012, PCR G15.

One thought on “Generic .htaccess redirect non-www to www (apache)”

Leave a Reply

%d bloggers like this: