/ Published in: Apache
I like using HTTP_HOST so it'll work in multiple environments, ie stage, production, dev, etc.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]