Tiap Hari Online

Non-www to www with .htaccess how to

The Fastest Way : Redirecting non-www to www with .htaccess.
Add the following code to your .htaccess file:

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

redirect non-www to www with .htaccess
6 steps for newbies:

1. Open your hosting cpanel.
2. Open File Manager
3. Choose domain (show hidden files)
4. Edit .htaccess file
5. Paste the code above
6. Save

This htaccess code will redirect any requests to to

For the SEO and canonical/duplicate content issues, you should choose one domain option and redirect when the other is used.

Blogger user also redirect blogger blog to custom domain name. Use this way for easy google indexing.

The benefits from redirecting non-www to www with .htaccess :
  • Avoiding duplicate content in Google
  • Avoiding the possibility of split page rank and/or split link popularity (inbound links).
  • It will look nicer, and more consistent.

Back To Top