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. Technical SEO Issues
    4. Looking for some help adding a 301 redirect for my Site

    Looking for some help adding a 301 redirect for my Site

    Technical SEO Issues
    5 3 633
    • 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.
    • debeenus
      debeenus last edited by

      Hi there,

      I am trying to eliminate the 'www' using a 301 redirect script as I have duplicate page titles for both versions (with and without the 'www')

      I checked the page authority and found the pages without the 'www' to be ranked higher. For this reason I believe it would be wise to go for this option.

      I have an .htaccess file, all I need is the code and I should be ok 🙂

      Thanks!

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

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

        StalkerB 1 Reply Last reply Reply Quote 1
        • debeenus
          debeenus last edited by

          Thanks a lot! Worked right away!

          1 Reply Last reply Reply Quote 0
          • StalkerB
            StalkerB @Highland last edited by

            `Is that right? Should it not be` 
            RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
            RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
            
            or even
            
            RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
            RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
            
            To be fair, I think all three of these will work.
            
            
            Highland 1 Reply Last reply Reply Quote 0
            • Highland
              Highland @StalkerB last edited by

              I never had any issues with it without the nocase flag but it couldn't hurt

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Redirect a 301 Redirect
                RedCaffeine
                RedCaffeine
                0
                5
                98

              • 301 Redirect Help
                dhidalgo1
                dhidalgo1
                1
                3
                115

              • Help with 301 redirect code
                Aleyda
                Aleyda
                0
                9
                191

              • Best practice for eCommerce site migration, should I 301 redirect or match URLs on new site
                Jinx14678
                Jinx14678
                0
                4
                1.2k

              • 301 redirecting old content from one site to updated content on a different site
                OlegKorneitchouk
                OlegKorneitchouk
                0
                2
                207

              • Ideally should a 301 or 302 redirect be used from https://www.site.com to http://www.site.com? Is there a valid reason to use a 302 in this situation or would using a 301 have any negative impact on seo?
                Unity
                Unity
                0
                2
                317

              • Will 301 redirecting a site multiple times still preserve the original site value?
                JoeAmadon
                JoeAmadon
                0
                2
                588

              • If I redirect my WordPress blog to my main site, will it help my main site's SEO?
                AspenFasteners
                AspenFasteners
                0
                3
                869

              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