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. Mod Rewrite question to prevent duplicate content

    Mod Rewrite question to prevent duplicate content

    Technical SEO Issues
    5 2 635
    • 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.
    • kat2
      kat2 last edited by

      Hi,

      I'm having problems with a mod rewrite issue and duplicate content

      On my website I have

      1. Website.com

      2. Website.com/directory

      3. Website.com/directory/Sub_directory_more_stuff_here

      Both #1 and #2 are the same page (I can't change this).  #3 is different pages.

      How can I use mod rewrite to to make #2 redirect to #1 so I don't have duplicate content WHILE #3 still works?

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

        Hi kat2,

        Hmmm...clearly, I should have slept before answering this , as I completely overlooked the fact that your second URL is actually a directory, so please ignore the first part of my original response (now removed), which would only work if you have a specific file to edit.

        Now to mod rewrite. I'm getting a sense that something else might be in play here, as your question suggests you have already tried to create a redirect and had problems.

        A couple of questions we need answered in order to get this answer right for you:

        • Is your site built on a CMS such as Joomla? Some CMS use their own redirect rules to rewrite URL's and these will overwrite the rules you write in .htaccess

        • Are you using a 301 Redirect rule, or just URL rewriting?

          • To create a 301 Redirect, your rewrite rule must end with [R=301] or [R=301,L] if it is the last.

        If you can answer these questions we will be better able to help sort the problem for you.

        Hope that helps,

        Sha

        kat2 1 Reply Last reply Reply Quote 0
        • kat2
          kat2 @ShaMenz last edited by

          Hello,

          My site is not built on a CMS but uses cakephp extensively

          I am not using 301 redirect.

          Regards 🙂

          ShaMenz kat2 2 Replies Last reply Reply Quote 0
          • ShaMenz
            ShaMenz @kat2 last edited by

            Hi again,

            I think the line of code below will create the 301 Redirect that you need:

            RewriteRule ^/dir$ / [R=301,L]

            Let me know if you come across any more problems with it.

            Hope that helps,

            Sha

            1 Reply Last reply Reply Quote 0
            • kat2
              kat2 @kat2 last edited by

              Unfortunately, I'm not an expert on rewriterule.

              Would it be:  RewriteRule ^/directory$ / http://www.website.com [R=301,L]

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Another Duplicate Content - eCommerce Question!
                Jubaer96
                Jubaer96
                0
                6
                288

              • When is Duplicate Content Duplicate Content
                AMHC
                AMHC
                0
                6
                169

              • Duplicate Content Question
                Travis_Bailey
                Travis_Bailey
                0
                7
                104

              • Duplicate content question...
                myfitstation
                myfitstation
                0
                7
                120

              • Duplicate Content Vs No Content
                MoosaHemani
                MoosaHemani
                0
                7
                404

              • Question about duplicate content in crawl reports
                CHADHARRIS
                CHADHARRIS
                1
                4
                243

              • Mod rewrite question
                ahirai
                ahirai
                0
                4
                279

              • Question about duplicate content within my site
                aprilm-189040
                aprilm-189040
                0
                4
                935

              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