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 9574 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.

    409 comments

    • Comment Link ATweply Thursday, 08 April 2021 00:59 posted by ATweply

      June 13, 2012 - vidalista de 60 mg y edegra 100 mg y tetosterona viagra generique livre sous 48h vidalista 40 http://www.kamagrapolo.com

    • Comment Link Ewhanna Saturday, 27 March 2021 20:18 posted by Ewhanna

      How lengthy can the as a rule mortals continue to be raise with viagra without a doctor prescription from canada paypal account. An erection can last from a few minutes to give half an hour. On normal, men bear five erections a night while they're sleeping, each lasting less 25 to 35 minutes to https://doctorhims.com/# viagra without subscription.

    • Comment Link ArthurKivok Wednesday, 24 March 2021 23:16 posted by ArthurKivok

      cheap ed pills from canada cheap ed pills in mexico
      cheap ed pills: https://medrx100.com/ canadian drugstore online
      mens erections buy ed pills from canada

    • Comment Link ArthurKivok Wednesday, 24 March 2021 17:34 posted by ArthurKivok

      cheap ed pills from india otc ed pills
      buy ed drugs: https://medrx100.com/ online meds for ed
      cheap ed pills in mexico medication for ed

    • Comment Link Herbertpiz Tuesday, 23 March 2021 14:18 posted by Herbertpiz

      buy ed pills from canada cheap ed pills from india
      ed pills without a doctor prescription: https://medrx100.com/ ed pharmacy
      natural ed pills cheap ed pills from canada

    • Comment Link Herbertpiz Tuesday, 23 March 2021 08:46 posted by Herbertpiz

      canadian pharmacy viagra without doctor prescription
      canada ed drugs: https://medrx100.com/ ed pills online
      ed pills without a doctor prescription cheap ed pills

    • Comment Link Herbertpiz Monday, 22 March 2021 16:40 posted by Herbertpiz

      cheap ed pills ed pills without a doctor prescription
      cheap ed pills in mexico: https://medrx100.com/ ed pills online
      buy ed pills aspirin and ed

    • Comment Link Lmoppfleet Monday, 22 March 2021 15:47 posted by Lmoppfleet

      [url=http://essaywriteris.com/]english essay writers[/url] how to be a better essay writer essay writers toronto famous essay writers

    • Comment Link Careyhon Saturday, 20 March 2021 20:16 posted by Careyhon

      viagra without a doctor prescription usa viagra 100mg price
      buy generic 100mg viagra online https://viagrapills100.com/ buy viagra online usa
      viagra without a doctor prescription usa where to buy viagra

    • Comment Link Trariut Monday, 15 March 2021 17:37 posted by Trariut

      http://vskamagrav.com/ - kamagra chewable 100 mg canada

    Leave a comment

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