javascript redirect from www to non-www code example
Example 1: javascript redirect
window.location.href = "http://mywebsite.com/home.html";
Example 2: How to redirect non-www URLs to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]