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. Need some help with a tricky 301

    Need some help with a tricky 301

    Intermediate & Advanced SEO
    8 3 524
    • 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.
    • DanDeceuster
      DanDeceuster last edited by

      I can't find anything online that deals with this issue. I have a page getting indexed by Google at mydomain.com/widgets and I don't know why. No links to it anywhere. The page it is closest to is mydomain.com/reviews/widgets and so I tried to set up a 301 to point one to the other.

      The problem is each individual widget review is at mydomain.com/widgets/reviews/products/widget-name and so when I redirect /widgets to mydomain.com/reviews/widgets it also redirects each individual product to mydomain.com/reviews/widgets/reviews/products/widget-name.

      Is there some way to just redirect /widgets without having it affect each product review? I cannot change URL structure either, nature of the site. Any ideas?

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

        Hi Daniel - Are you using htaccess to handle your redirects.  I think you'll need to employ some Regular Expressions to handle what you're trying to accomplish.  As a guide, here is a very nice writeup on RegEx from - where else - SEOmoz: http://www.seomoz.org/blog/an-seos-guide-to-regex

        so, in this case, i think what you'll want is:

        RewriteEngine On

        **RewriteRule ^widgets/?$ reviews/widgets [NC]**so, the caret (^) ensures that the url starts with widgets, while the dollar sign ensures that the redirect rule stops there (eliminating that pesky problem you encountered with the review pages also getting redirected).  The ? just means that the trailing slash is optional.Hope that helps.  If this solution isn't feasible, you could always hedge with rel="canonical" on the mydomain.com/widgets page and have that point to the proper page.  That will at least help with Google.-Jason

        DanDeceuster 1 Reply Last reply Reply Quote 1
        • DanDeceuster
          DanDeceuster @JasonCook last edited by

          It is not working for me. Nothing is redirecting when I add this to the .htaccess file. First I added it as you suggested at the bottom of everything. Nothing happened so I added right after another line of code that was already in there that started with RewriteRule. This is the line that was already there:

          RewriteRule ^.*$ index.php [NC,L]

          Any idea what could be going wrong? Thanks in advance!

          JasonCook DanDeceuster ShaMenz 5 Replies Last reply Reply Quote 0
          • JasonCook
            JasonCook @DanDeceuster last edited by

            Well, that's no fun. If there is already a line to initiate the rewrite engine, that 2nd 'rewriteengine on' reference could be a problem. I assume you took that out?

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

              Yeah I took the ReweriteEngine On line out and just added the RewriteRule line in underneat that one. Although it doesn't say anywhere RewriteEngine On in the .htaccess file already, so not sure how that works.

              1 Reply Last reply Reply Quote 0
              • JasonCook
                JasonCook @DanDeceuster last edited by

                Gotcha. Try adding the rewriteengine on line directly above those two rules. That has to be present to trigger the mod_rewrite module. Hopefully that will solve the issue.

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

                  Just not happening. I'm just not going to worry about it, thanks for your help

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

                    Hi Daniel,

                    Whenever I hear "Nothing is redirecting when I add this to the .htaccess file" I have one thought:

                    Is the site using Joomla, Drupal or some other CMS that will overwrite .htaccess rules externally?

                    Sha

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    • First post
                      Last post
                    • I need help on how best to do a complicated site migration. Replacing certain pages with all new content and tools, and keeping the same URL's. The rest just need to disappear safely. Somehow.
                      Everett
                      Everett
                      1
                      4
                      58

                    • I need help!
                      HillyCE
                      HillyCE
                      0
                      5
                      119

                    • Need help creating sitemap
                      KenyonManu3-SEOSEM
                      KenyonManu3-SEOSEM
                      0
                      3
                      191

                    • Help needed for a domain
                      smarties954
                      smarties954
                      0
                      2
                      103

                    • Do my redirects on my homepage need to be 301?
                      EcommerceSite
                      EcommerceSite
                      0
                      8
                      322

                    • Help Needed With .htaccess RewriteRule
                      AdeLewis
                      AdeLewis
                      0
                      3
                      367

                    • I need help with htaccess redirect
                      RyanKent
                      RyanKent
                      0
                      4
                      1.1k

                    • Help Needed - 301 a .co.uk to a .com Serp Questions
                      stevenmusumeche
                      stevenmusumeche
                      0
                      2
                      917

                    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