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 8372 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 Howardwheve Tuesday, 19 January 2021 04:15 posted by Howardwheve

      sqys viagra discount http://dietkannur.org assg cqyp

    • Comment Link Jvcbxjorma Tuesday, 19 January 2021 01:25 posted by Jvcbxjorma

      cialis 20mg tablets price discount cialis 20mg which is better cialis or levitra [url=http://phrcialiled.com/]cialis and viagra taken together[/url] ’

    • Comment Link KlioSync Monday, 18 January 2021 10:33 posted by KlioSync

      what is the best viagra alternative viagra 100mg nz viagra online boots viagra viagra gum viagra online without prescription viagra, viagra with dapoxetine viagra pay pal making viagra viagra cheap cheapest viagra ireland paypal pfirer viagra substitute viagra uk buy viagra online

    • Comment Link Howardwheve Monday, 18 January 2021 00:54 posted by Howardwheve

      vlqj how to get viagra without a doctor http://dietkannur.org zcvx xkhh

    • Comment Link Eldonephef Sunday, 17 January 2021 03:16 posted by Eldonephef

      discount viagra okljaupl generic viagra cheap viagra 100mg
      viagra without a doctor prescription canada https://edcheapgeneric.com/ ayodtumw how much does viagra cost
      cialis generic availability cheap cialis lowest cialis prices

    • Comment Link PeterHop Sunday, 17 January 2021 02:02 posted by PeterHop

      how much does viagra cost zffprrri buy viagra generic cheap generic viagra
      muse for ed http://canadarx24.online/ online drug store bsdyxuos
      best place to buy viagra online buy sildenafil viagra discount

    • Comment Link PeterHop Saturday, 16 January 2021 15:52 posted by PeterHop

      herbal ed remedies vshqcbev levitra natural help for ed
      buy prescription drugs without doctor http://canadarx24.online/ buy online pharmacy auzdkraw
      order viagra online cheap sildenafil roman viagra

    • Comment Link RichardNah Saturday, 16 January 2021 12:50 posted by RichardNah

      online canadian drugstore rtgmwrqe levitra for sale ed remedies that really work
      fastest delivery of cialis buying online kfldbfuv http://edcheapgeneric.online/ how long does 20mg cialis keep in system
      cialis free trial cialis coupon cialis professional

    • Comment Link NlbxSmert Saturday, 16 January 2021 01:40 posted by NlbxSmert

      genelic viagra viagra order printable viagra coupons buy viagra uk synthetic viagra fast shipping viagra cheap purchase viagra online canada viagra cheap cheapest online viagra canada pharmacy legal viagra viagra in india chennai viagra online sell viagra 50mg best viagra online toronto viagra with dapoxetine

    • Comment Link Eldonephef Friday, 15 January 2021 17:14 posted by Eldonephef

      ed pills otc uuryrmyg buy generic levitra cheap ed drugs
      comfortis without vet prescription http://canadarx24.online/ online canadian drugstore vpgjztkx
      viagra no prescription order viagra is viagra over the counter

    Leave a comment

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