Tuesday, 10 October 2017 14:36

    How to create Redirect non-www to www using htaccess

    Written by
    Rate this item
    (1 Vote)

    Technically speaking, both www and non-www are 2 different websites and as such may be penalised by search engines for duplicated content. From an SEO perspective it is always best practice to redirect your non-www site URL to www or your wwww. to your non-www version.

    Our site www.accrodigital.com, for example, has a redirection from non-www (http://accrodigital.com) to www (http://www.accrodigital.com). In other, everytime anyone type http://accrodigital.com will be redirected to www.accrodigital.com. Note the "www" in the second URL.

    Technically, the non-www version and the www version are two different domains. So redirecting one to the other improves our SEO. Google and other search engines won't have to worry about two different domains.

    This tutorial will show you how to redirect your whole website to either non-www or www.

    Please note that you will need to find and access your htaccess file. It is located at the root of your website server.

    1. Locate the following line within your htaccess file

    RewriteEngine On

    2. To redirect non-www to www, add this code below it:

    RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

    3. To redirect www to non-www, add this code after RewriteEngine On:

    RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

    I hope that this tutorial will help you. Please leave your comment below if any.

    Read 17654 times Last modified on Wednesday, 11 October 2017 07:54
    Fabien Bello

    Fabien Bello has been working in web and app develoment since 1997. He has held numerous positions from game developer to head of creative and product development for major firms such as Xerox, Gala Coral Group. Fabien continues contributing to online community, owns and manages several websites as well as offering consultancy to all size businesses.


    • Comment Link MelvinNuarl Tuesday, 09 February 2021 18:10 posted by MelvinNuarl

      clomid price for cost of prednisone 5mg tablets or clomid prescription

    • Comment Link Jameszency Monday, 08 February 2021 17:38 posted by Jameszency

      cheapest generic viagra viagra price comparison
      online doctor prescription for viagra http://valemigente.com/ where to get viagra
      cheap generic viagra viagra without prescription

    • Comment Link AqcfSkellalat Monday, 08 February 2021 14:48 posted by AqcfSkellalat

      cialis soft tabs canadian pharmacy cialis on line overnight cialis super active vs professional

    • Comment Link AqcfSkellalat Monday, 08 February 2021 14:46 posted by AqcfSkellalat

      cialis soft tabs canadian pharmacy cialis on line overnight cialis super active vs professional

    • Comment Link NncsSmert Sunday, 07 February 2021 19:19 posted by NncsSmert

      rx pharmacy viagra no prescription canada pfizer buy viagra with paypal

    • Comment Link ThomasDot Sunday, 07 February 2021 15:59 posted by ThomasDot

      best treatment for ed erectile dysfunction drugs
      best male enhancement pills http://generictadalafil20.online/ new ed drugs
      compare ed drugs best ed treatment pills

    • Comment Link Heathnup Friday, 05 February 2021 18:36 posted by Heathnup

      how to cure ed ed pills gnc
      pills erectile dysfunction http://generictadalafil20.online/ how to cure ed
      new ed treatments п»їerectile dysfunction medication

    • Comment Link Jbbvfleet Friday, 05 February 2021 18:21 posted by Jbbvfleet

      prescription prices comparison canadian discount pharmacy Brand Viagra

    • Comment Link Tyronevox Friday, 05 February 2021 01:19 posted by Tyronevox

      what is the best ed pill erectile dysfunction pills
      cheap erectile dysfunction pill http://genericvgr.online/ erection pills online
      best erection pills treatments for ed

    • Comment Link ThomasDot Thursday, 04 February 2021 21:34 posted by ThomasDot

      ed pills that really work best erection pills
      ed drug prices http://genericvgr.online/ male ed pills
      ed drugs compared ed treatment drugs

    Leave a comment

    Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.