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. Using Reg Ex to 301 old categories and query strings in Magento

    Using Reg Ex to 301 old categories and query strings in Magento

    Intermediate & Advanced SEO
    3 2 320
    • 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.
    • Tone_Agency
      Tone_Agency last edited by

      Hi SEOmoz community!

      I'm hoping somebody with a little Magento and Reg Ex knowledge will be able to help me out here.

      I need to 301 some old categories along with their old query strings. Below is an example.

      Old URL

      /bed-linen/pillowcases-html.html

      Users can then filter by price or range which then creates a query string such as...

      /bed-linen/pillowcases-html.html?price=1%2C10

      New URL:

      /bed-linen/pillowcases.html

      So the new query string will be

      /bed-linen/pillowcases.html?price=1%2C10

      Does anybody know the Reg Ex to 301 this? Can this be done in Magento re-write module or by htaccess only?

      Thanks in advance 🙂

      Anthony

      @Anthony_Mac85

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

        I'd suggest checking with your host. I'm not sure if your reference to reg ex means "reg ex" in the sense of it being reforwarding software, or in the sense of using regular expressions to type syntax to handle it.

        most hosts will have reforwarding software of some sort installed with their user accounts (the 301 thing is pretty common). once they let you know what it is (for example it might be apache's mod-rewrite or isapirewrite.com), you can figure out the format you need to write the rewrite commands in.  some of them use IIS, some of them use .htacess, it all just depends.

        if your old url and new urls are in respective "structures" you may also be able to put in wildcards to handle the directory words all at once.

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

          Thanks for taking the time to answer.

          Yeh I mean regular expression, it's apache mod-rewrite and we use .htaccess

          I'm struggling to figure out to 301 old url query strings to the new ones. There are several possible query strings for each product category so would take forever to do them one by one in magento re-write. The query strings will be the same i.e. ?price=1%2C10 but the category url will be different as you can see in my example above.

          any ideas or do I need to hire an expert?

          Thanks

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • PLEASE HELP - Old query string URL causing problems
            Nigel_Carr
            Nigel_Carr
            1
            6
            96

          • Sitelink Search Box mark-up when multiple query strings are used
            StephanSolomonidis
            StephanSolomonidis
            0
            2
            120

          • Multiple 301 Redirect Query
            PeteC12
            PeteC12
            0
            3
            82

          • 301 and Canonical - is using both counterproductive
            AlanMosley
            AlanMosley
            0
            6
            130

          • How to use a 301 Redirect when the first 301 Redirect is not the same as what's indexed?
            PatriotOutfitters81
            PatriotOutfitters81
            0
            3
            66

          • SEO & Magento Multistore - I have been asked if "duplicatiing" a magento stor using its "Multistore" functionality will cause both to be picked up as duplicate content, can anybody help?
            SanketPatel
            SanketPatel
            0
            2
            376

          • Should i use Categories or Tags ?
            evolvingSEO
            evolvingSEO
            1
            4
            2.1k

          • Is This 301 Use Best Practice??
            KaneJamison
            KaneJamison
            0
            5
            539

          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