Portal Home > Knowledgebase > HTML > Redirecting non-www to www with .htaccess

Redirecting non-www to www with .htaccess

To redirect all non-www requests to your site, just add the following code to your .htaccess file.

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

It will redirect any requests to to There well be several benefits:

  • Avoid duplicate content in Google Search
  • also avoid the possibility of split page rank and/or split link popularity (inbound links).
  • Nicer, and more consistent.
Was this answer helpful?
0 Users Found This Useful 0 Votes