The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Intermediate & Advanced SEO
    4. I need help with htaccess redirect

    I need help with htaccess redirect

    Intermediate & Advanced SEO
    4 2 1.1k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • imrubbish
      imrubbish last edited by

      Hi guys,

      we have the domain cheats.co.uk, it has always displayed as cheats.co.uk without the www.

      However it is now showing 2 version of the site, both the www. and the non www. version.

      I know how to add to the htaccess folder to get the non www. version going to the www. version but i am worried about doing this because the non www. version has always been the one indexed in Google and has a page rank of 3.

      Should i in fact be redirecting the www.version to the non www. version to keep page rank etc? or will page rank be passed over etc if i redirect to the www. version

      I hope thats clear

      Thanks guys

      Jon

      1 Reply Last reply Reply Quote 0
      • RyanKent
        RyanKent last edited by

        You can use the "www" or non-www form of your URLs. The important thing is to make a choice then stay consistent with your choice.

        PageRank and links will be fine with either choice. Whenever you use a redirect you lose a small amount of link juice. All things being equal, determine which form of URL is most commonly used in your backlinks, then use that URL.

        The method for a redirect depends on your hardware and software. The most common configuration for web servers is currently Apache servers with cPanel access. If you have this setup, you can use the Redirect application or ask your host to set the redirect up for you. I would not recommend making the change manually. One character out of place and your server will be instantly inaccessible.

        With the above noted, below is code which can be added to your htaccess file to redirect non-www traffic to the www equivalent. I am not a htaccess expert and the code below you can use at your own risk. It works for me.

        `RewriteEngine On
        RewriteCond %{HTTP_HOST} !^www\.
        RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]`
        
        
        imrubbish 1 Reply Last reply Reply Quote 0
        • imrubbish
          imrubbish @RyanKent last edited by

          Hi Ryan,

          Thanks for your answer. I believe that it was the non www version which has been used since existence and this has a page rank 3, i do think it looks better in the serps with the www.version though. From your experience the page rank and most of the link juice that is on the non www. version should transfer over to the www. version in time?

          The redirect i was going to put on was

          Options +FollowSymlinks
          RewriteEngine on
          rewritecond %{http_host} ^domain.com [nc]
          rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

          RyanKent 1 Reply Last reply Reply Quote 0
          • RyanKent
            RyanKent @imrubbish last edited by

            Any redirect causes an estimated 1 - 10% loss of link juice. If all your links use the non www version, then from a pure SEO link value perspective you should redirect the www version to the non www version of your URL.

            If you are on good terms with the sites who are providing those links, you could also ask them to update their links to your new structure. It's a decision you will need to make.

            Your htaccess code seems ok. Once again, that is not my area of expertise. I created the code I used with the Redirect app in cPanel and have copied it.

            1 Reply Last reply Reply Quote 1
            • 1 / 1
            • First post
              Last post
            • Help needed on HTTPS
              Andy-Halliday
              Andy-Halliday
              0
              6
              64

            • How to redirect an url in .htaccess when "redirect 301" doesnt work
              WilliamKammer
              WilliamKammer
              0
              5
              173

            • Redirects in .htaccess file
              Rebeca1
              Rebeca1
              0
              3
              86

            • .htaccess 301 Redirect Help! Specific Redirects and Blanket Rule
              LynnPatchett
              LynnPatchett
              0
              3
              3.1k

            • Help with htaccess
              Aleyda
              Aleyda
              0
              2
              85

            • 301 Redirect htaccess
              Christy-Correll
              Christy-Correll
              0
              8
              256

            • Redirect help
              EcommerceSite
              EcommerceSite
              0
              11
              226

            • Help needed regarding 1:1 Redirection
              ITRIX
              ITRIX
              0
              3
              174

            Get started with Moz Pro!

            Unlock the power of advanced SEO tools and data-driven insights.

            Start my free trial
            Products
            • Moz Pro
            • Moz Local
            • Moz API
            • Moz Data
            • STAT
            • Product Updates
            Moz Solutions
            • SMB Solutions
            • Agency Solutions
            • Enterprise Solutions
            • Digital Marketers
            Free SEO Tools
            • Domain Authority Checker
            • Link Explorer
            • Keyword Explorer
            • Competitive Research
            • Brand Authority Checker
            • Local Citation Checker
            • MozBar Extension
            • MozCast
            Resources
            • Blog
            • SEO Learning Center
            • Help Hub
            • Beginner's Guide to SEO
            • How-to Guides
            • Moz Academy
            • API Docs
            About Moz
            • About
            • Team
            • Careers
            • Contact
            Why Moz
            • Case Studies
            • Testimonials
            Get Involved
            • Become an Affiliate
            • MozCon
            • Webinars
            • Practical Marketer Series
            • MozPod
            Connect with us

            Contact the Help team

            Join our newsletter
            Moz logo
            © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
            • Accessibility
            • Terms of Use
            • Privacy