How Redirecting non-www to www with .htaccess?


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

Advertisements

Sr. Software Engineer

Tagged with: , , ,
Posted in Drupal, Joomla, PHP, Wordpress
21 comments on “How Redirecting non-www to www with .htaccess?
  1. Hello, of course this article is really good and I have
    learned lot of things from it regarding blogging.
    thanks.

  2. It’s difficult to find knowledgeable people about this topic, however,
    you seem like you know what you’re talking about!
    Thanks

  3. Hier Klicken says:

    Hi to every body, it’s my first pay a visit of this blog; this website consists of amazing and actually good data
    for visitors.

  4. Stunning quest there. What happened after? Good luck!

  5. Hello! I could have sworn I’ve been to this website
    before but after checking through some of the post I realized it’s new to me.
    Anyhow, I’m definitely delighted I found it and I’ll be bookmarking and
    checking back frequently!

  6. b ostermann says:

    Hey I know this is off topic but I was wondering if you knew of any widgets I could add
    to my blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this.

    Please let me know if you run into anything.
    I truly enjoy reading your blog and I look
    forward to your new updates.

  7. Malissa says:

    I have read so many posts about the blogger lovers except this post is really a nice post, keep it up.

  8. Silvana says:

    Awesome issues here. I’m very glad to see your post.
    Thank you so much and I’m looking forward to touch you.
    Will you please drop me a mail?

  9. Excellent website you have here but I was wondering
    if you knew of any discussion boards that cover the same topics discussed in this article?
    I’d really like to be a part of group where I can get feed-back from other experienced people that share the same interest.
    If you have any recommendations, please let me know.

    Bless you!

  10. Angela says:

    Greetings! Very useful advice within this article! It’s the
    little changes that will make the most important changes.
    Many thanks for sharing!

  11. Marcel says:

    I blog quite often and I really appreciate your information.
    This great article has truly peaked my interest. I am going to bookmark your website and keep checking for new details about once a week.
    I subscribed to your RSS feed too.

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

%d bloggers like this: