How Redirecting non-www to www with .htaccess?

Raghunath Gurjar

Hello Everyone!

Hope you are enjoy my code !

I am here now just going to tell you all a simple way for redirect your website from non www( to www(( URL .

If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file:

RewriteEngine On
##non www to www
RewriteCond %{HTTP_HOST} ^esiwaste\.com [NC]
RewriteRule (.*)$1 [L,R=301]

This will redirect any requests to to There are several benefits from doing that:

  • It will avoid duplicate content in Google
  • It will avoid the possibility of split page rank and/or split link popularity (inbound links).
  • It’s nicer, and more consistent.

Enjoy Code!



View original post


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s