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. Help with 301 redirect code

    Help with 301 redirect code

    Technical SEO Issues
    9 4 191
    • 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.
    • Paul_MC
      Paul_MC last edited by

      Hi,

      I can't work out how to make this one work and would apreciate if someone could help.
      i have a series of folders from a old site that are in the structure:
      /c/123456/bags.html   (the "123456" changes and is any series of 6 digit numbers), and the "bags.html" changes depending on the product.
      I need that to be 301 redirected to the following format:
      /default/bags/bags.html

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

        ok this needs clarifying

        so your old urls want to be of the format /default/category/bags.html yes?

        does the category relate to the 6 digit number in some way?

        Are you using a shopping care of some kind or is this a bespoke system?

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

          Hi there

          First of all, does your site use an .htaccess file? This is probably the most common solution used to implement 301 redirects.  The SEOMoz guide to redirection is really useful in explaining how to implement redirects for apache servers and others.

          These three generators can create the code for you, but it's very important to learn how the .htaccess file works before trying to implement it. Therefore, you should acquaint yourself fully with the Moz guide linked above.

          Alternatively, if your site is running WordPress, you can setup 301 redirects very easily with the Yoast SEO plugin.

          Hope these resources help.

          1 Reply Last reply Reply Quote 1
          • Paul_MC
            Paul_MC last edited by

            thanks guys.
            Andy...
            yes, i need the new format to be /default/category/bags.html (but the bags.html will vary with whatever the original product is).
            The category has no relation to the new category. It was generated by a old cms system and seems to fluctuate.
            Yes, it is a Magento shopping cart

            Tom,
            yes, it is .htaccess>
            I have added some other 301 redirects successfully, but can't work out how to change the 6 digit category, while still making sure the end product (eg bags.html) redirects to bags.html in the new structure.

            I hope that makes sense?

            Thanks
            Paul

            SEOAndy 1 Reply Last reply Reply Quote 0
            • SEOAndy
              SEOAndy @Paul_MC last edited by

              oh erm sounds a little odd set up - maybe worth trying http://shop.ecomdev.org/url-rewrite-indexer.html

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

                Thanks Andy, i'll take a look.

                I'm no htaccess guru, but was hoping that there was some sort of wildcard that could:
                find "any product" (eg bags.html) in categories /c/123456/ and redirect to /default/bags/

                i just can't get my head around it. Is there a * or ? or combination? as it would need to pick up the changing 6 digits

                SEOAndy Aleyda 2 Replies Last reply Reply Quote 0
                • SEOAndy
                  SEOAndy @Paul_MC last edited by

                  it would be hard to do without knowing the system really well, though that plugin maybe able to help. The reason is that if those codes change they could mean any category - the last bit is likely not an issue of product name as url, but the category bit isn't so easy - unless it can be ignored and pulled from the CMS - again not being a magento expert I don't know how this would be done. sorry.

                  Paul_MC 1 Reply Last reply Reply Quote 0
                  • Paul_MC
                    Paul_MC @SEOAndy last edited by

                    no worries Andy, I really appreciate you trying

                    1 Reply Last reply Reply Quote 0
                    • Aleyda
                      Aleyda @Paul_MC last edited by

                      Hi Paul,

                      As Andy mentioned earlier, the complexity here comes by the fact that these IDs cannot be simply removed since they play a role in the Magento product/category system.

                      The first step would be that you identify how these are generated to identify the best way to optimize it to become relevant or at least doesn't add more depth and complexity in the URL structure.

                      I've seen that there's a URL rewrite area in Magento with some system configuration options that you might want to take a look here and to this in-depth guide explaining Magento URL rewrites.

                      I've also seen that a similar question has been asked in Stackoverflow and as you can see the potential alternatives discussed here goes into Magento's system configuration.

                      Hope this helps!

                      Aleyda

                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      • First post
                        Last post
                      • 301 Redirects - Clearing out a 300 Page WordPress Website (HELP)
                        AnuragGarry
                        AnuragGarry
                        0
                        2
                        27

                      • How to redirect 302 status to 301 status code using wordpress
                        ThompsonPaul
                        ThompsonPaul
                        0
                        4
                        1.3k

                      • 301 Redirect Help
                        dhidalgo1
                        dhidalgo1
                        1
                        3
                        115

                      • Htaccess code to 301 redirect a folder change
                        Paul_MC
                        Paul_MC
                        0
                        4
                        160

                      • Help writing a .htacess file with the correct 301 redirects
                        mememax
                        mememax
                        0
                        5
                        148

                      • To 301 redirect or not to 301 redirect? duplicate content problem www.domain.com and www.domain.com/en/
                        Chris-CA
                        Chris-CA
                        0
                        5
                        456

                      • Looking for some help adding a 301 redirect for my Site
                        Highland
                        Highland
                        0
                        5
                        633

                      • 301 Redirect for homepage with language code
                        kwoolf
                        kwoolf
                        0
                        4
                        2.0k

                      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