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. Redirect 301 & Wild Cards

    Redirect 301 & Wild Cards

    Technical SEO Issues
    4 2 71
    • 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.
    • scottiedog
      scottiedog last edited by

      Afternoon All!

      Question, I am having trouble getting my head around redirects and I am wondering if someone could help me on this....

      We recently changed our website and although were using the same database, were using a different URL structure.  So for example...

      Old URL siteurl.com/products/product/moredetails/merlin.id1553.html
      New URL siteurl.com//vertigo/dl/product.php?p=1553

      As you can see the product has the same ID number, just in a different directory.  What I'd like to happen is....

      If you go too siteurl.com////.idXXXX.html then you are 301'd too siteurl.com//vertigo/do/product.php?p=XXXX

      Obviously XXXX is the ID number of the product in our database.

      Any thoughts?  I need help!

      Thanks in advance.

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

        Hi Richard. This is a fairly complicated redirection scheme you hope to achieve. I'd hire out for a someone skilled in Regex to pull it off smoothly.

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

          Ryan,

          You were spot on, hired a chap to do just that.  If anyone in the future is interested in the solution it was just this...

          RedirectMatch 301 ^(.)/(.)/(.)/(.).id([\d]+).html$ myurl.com/vertigo/dl/product.php?p=$5

          RyanPurkey 1 Reply Last reply Reply Quote 0
          • RyanPurkey
            RyanPurkey @scottiedog last edited by

            Excellent! It matches up nicely with the example you provided, and always good to have someone on hand to make sure everything works as intended. Glad you found a good one.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Canonicals & 301 Redirects to new Domain
              MonicaOConnor
              MonicaOConnor
              0
              2
              54

            • Redirect a 301 Redirect
              RedCaffeine
              RedCaffeine
              0
              5
              98

            • 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

            • Delete 301 redirected pages from server after redirect is in place?
              RuthBurrReedy
              RuthBurrReedy
              0
              5
              4.0k

            • 301 redirects & merging two sites into one
              Anthony_NorthSEO
              Anthony_NorthSEO
              0
              2
              1.1k

            • 301 Redirect & Linking Root Domain Count
              iAnalyst.com
              iAnalyst.com
              0
              2
              466

            • 301 Redirect & Cloaking
              RyanKent
              RyanKent
              0
              7
              2.9k

            • 301 Redirects
              KT684
              KT684
              0
              5
              711

            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