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(http://yourdomain.com) to www((http://www.yourdomain.com)) 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 (.*) http://www.esiwaste.com/$1 [L,R=301]

This will redirect any requests to http://mrwebsolution.in to http://www.mrwebsolution.in. 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!

Screenshot-1

Screenshot-2

View original post

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s