Skip to content
    Moz logo Menu open Menu close
    • Products
      • Moz Pro
      • Moz Pro Home
      • Moz Local
      • Moz Local Home
      • STAT
      • Moz API
      • Moz API Home
      • Compare SEO Products
      • Moz Data
    • Free SEO Tools
      • Domain Analysis
      • Keyword Explorer
      • Link Explorer
      • Competitive Research
      • MozBar
      • More Free SEO Tools
    • Learn SEO
      • Beginner's Guide to SEO
      • SEO Learning Center
      • Moz Academy
      • SEO Q&A
      • Webinars, Whitepapers, & Guides
    • Blog
    • Why Moz
      • Agency Solutions
      • Enterprise Solutions
      • Small Business Solutions
      • Case Studies
      • The Moz Story
      • New Releases
    • Log in
    • Log out
    • Products
      • Moz Pro

        Your all-in-one suite of SEO essentials.

      • Moz Local

        Raise your local SEO visibility with complete local SEO management.

      • STAT

        SERP tracking and analytics for enterprise SEO experts.

      • Moz API

        Power your SEO with our index of over 44 trillion links.

      • Compare SEO Products

        See which Moz SEO solution best meets your business needs.

      • Moz Data

        Power your SEO strategy & AI models with custom data solutions.

      NEW Keyword Suggestions by Topic
      Moz Pro

      NEW Keyword Suggestions by Topic

      Learn more
    • Free SEO Tools
      • Domain Analysis

        Get top competitive SEO metrics like DA, top pages and more.

      • Keyword Explorer

        Find traffic-driving keywords with our 1.25 billion+ keyword index.

      • Link Explorer

        Explore over 40 trillion links for powerful backlink data.

      • Competitive Research

        Uncover valuable insights on your organic search competitors.

      • MozBar

        See top SEO metrics for free as you browse the web.

      • More Free SEO Tools

        Explore all the free SEO tools Moz has to offer.

      What is your Brand Authority?
      Moz

      What is your Brand Authority?

      Check yours now
    • Learn SEO
      • Beginner's Guide to SEO

        The #1 most popular introduction to SEO, trusted by millions.

      • SEO Learning Center

        Broaden your knowledge with SEO resources for all skill levels.

      • On-Demand Webinars

        Learn modern SEO best practices from industry experts.

      • How-To Guides

        Step-by-step guides to search success from the authority on SEO.

      • Moz Academy

        Upskill and get certified with on-demand courses & certifications.

      • SEO Q&A

        Insights & discussions from an SEO community of 500,000+.

      Unlock flexible pricing & new endpoints
      Moz API

      Unlock flexible pricing & new endpoints

      Find your plan
    • Blog
    • Why Moz
      • Small Business Solutions

        Uncover insights to make smarter marketing decisions in less time.

      • Agency Solutions

        Earn & keep valuable clients with unparalleled data & insights.

      • Enterprise Solutions

        Gain a competitive edge in the ever-changing world of search.

      • The Moz Story

        Moz was the first & remains the most trusted SEO company.

      • Case Studies

        Explore how Moz drives ROI with a proven track record of success.

      • New Releases

        Get the scoop on the latest and greatest from Moz.

      Surface actionable competitive intel
      New Feature

      Surface actionable competitive intel

      Learn More
    • Log in
      • Moz Pro
      • Moz Local
      • Moz Local Dashboard
      • Moz API
      • Moz API Dashboard
      • Moz Academy
    • Avatar
      • Moz Home
      • Notifications
      • Account & Billing
      • Manage Users
      • Community Profile
      • My Q&A
      • My Videos
      • Log Out

    The Moz Q&A Forum

    • Forum
    • Questions
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. Home
    2. SEO Tactics
    3. Intermediate & Advanced SEO
    4. Htaccess - Redirecting TAG or Category pages

    Moz Q&A is closed.

    After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

    Htaccess - Redirecting TAG or Category pages

    Intermediate & Advanced SEO
    3
    4
    900
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with question management privileges can see it.
    • Jes-Extender-Australia
      Jes-Extender-Australia last edited by

      Hello Fellow Moz's,

      We have an issue redirecting some /TAG and /Category pages to inner pages.

      As an example we use:

      RedirectMatch 301 /category/Sample-Category(.*) https://OurDomain.com.au/New-Page//$1

      That works well.

      The issue is we have other categories and tags that are named similar to /Sample-Category

      As an example, if we try to redirect /Sample-Category-1 to /New-Page-1 - it will not work, and redirects to /New-Page

      I assume this is because /Sample-Category is already being redirected, so anything after /Sample-Category like -1 or -2 or -3 etc, will not be recognized.

      Anyone know of a workaround?

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

        The regex in your RedirectMatch doesn't say what you think it says, Jes 🙂

        This part (note the bolded part of the expression (.*)😞

        /category/Sample-Category**(.*)**

        doesn't actually say "match the URL that is specifically** /category/Sample-Category"**

        That**.*** is a wildcard thatmeans "and any other additional characters that might occur here"

        So what it's saying is "match the URL /category/Sample-Category _**as well as **_any URLs that have any additional characters after the letter "y" in category. Which is what is catching your -1 variation of the URL (or the -size-30 in your second example).

        In addition, that wildcard has been set as a variable (the fact it's in brackets), which you are then attempting to insert into the end of the new URL (with the $1), which I don't think is your intent.

        Instead, try:

        RedirectMatch 301 /category/Sample-Category https://OurDomain.com.au/New-Page/

        you should get the redirect you're looking for, and not have it interfere with the other ones you wish to write.

        Let me know if that solves the issue? Or if I've misunderstood why you were trying to include the wildcard variable?

        Paul

        P.S. You'll need to be very specific whether the origin or target URLs use trailing slashes - I just replicated the examples you provided.

        1 Reply Last reply Reply Quote 1
        • Jes-Extender-Australia
          Jes-Extender-Australia @seoman10 last edited by

          It's not as easy as that unfortunately.

          I will reiterate.....If we redirect.....

          RedirectMatch 301 /category/Blue-Shirts https://OurDomain.com.au**/Blue-Shirts**//$1 - it works, BUT....if we redirect another similar category page to different inner page like....

          RedirectMatch 301 /category/Blue-Shirts-Size-30 https://OurDomain.com.au****/Blue-Shirts-Size-30****//$1 - it redirects to the first inner page example above.

          That's why I was assuming it's not working because in the second example the sever sees /Blue-Shirts and ignores everything after it i.e the "Size-30".

          Hopefully that makes it clearer?

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

            If I've understood you correctly, all you need to do is to add a tag with the relevant content same as the old one.

            Jes-Extender-Australia 1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post

            Got a burning SEO question?

            Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


            Start my free trial


            Browse Questions

            Explore more categories

            • Moz Tools

              Chat with the community about the Moz tools.

            • SEO Tactics

              Discuss the SEO process with fellow marketers

            • Community

              Discuss industry events, jobs, and news!

            • Digital Marketing

              Chat about tactics outside of SEO

            • Research & Trends

              Dive into research and trends in the search industry.

            • Support

              Connect on product support and feature requests.

            • See all categories

            Related Questions

            • amberprata

              301 Redirects for Multiple Language Sites in htaccess File

              Hi everyone, I have a site  on a subdomain that has multiple languages set up at the domain level: https://mysite.site.com, https://mysite.site.fr ,  https://mysite.site.es , https://mysite.site.de , etc. We are migrating to a new subdomain and I am trying to create 301 redirects within the htaccess file, but I am a bit lost on how to do this as it seems you have to go from a relative url to an absolute - which would be fine if I was only doing this for the english site, but I'm not. It doesn't seem like I can go from absolute url to an absolute url - but I could be wrong. I am new to editing the htaccess file - so I could definitely use some advice here. Thanks.

              Intermediate & Advanced SEO | | amberprata
              0
            • TrueluxGroup

              Multiple pages optimised for the same keywords but pages are functionally different and visually different

              Hi MOZ community! We're wondering what the implications would be on organic ranking by having 2 pages, which have quite different functionality were optimised for the same keywords. So, for example, one of the pages in question is
              https://www.whichledlight.com/categories/led-spotlights
              and the other page is
              https://www.whichledlight.com/t/led-spotlights both of these pages are basically geared towards the keyword led spotlights the first link essentially shows the options for led spotlights, the different kind of fittings available, and the second link is a product search / results page for all products that are spotlights. We're wondering what the implications of this could be, as we are currently looking to improve the ranking for the site particularly for this keyword. Is this even safe to do? Especially since we're at the bottom of the hill of climbing the ranking ladder of this keyword. Give us a shout if you want any more detail on this to answer more easily 🙂

              Intermediate & Advanced SEO | | TrueluxGroup
              0
            • RosemaryB

              Should we 301 redirect old events pages on a website?

              We have a client that has an events category section that is filled to the brim with past events webpages.  Another issue is that these old events webpages all contain duplicate meta description tags, so we are concerned that Google might be penalizing our client's website for this issue.   Our client does not want to create specialized meta description tags for these old events pages. Would it be a good idea to 301 redirect these old events landing pages to the main events category page to pass off link equity & remove the duplicate meta description tag issue?   This seems drastic (we even noticed that searchmarketingexpo.com is keeping their old events pages).  However it seems like these old events webpages offer little value to our website visitors. Any feedback would be much appreciated.

              Intermediate & Advanced SEO | | RosemaryB
              0
            • rpaiva

              Adding a Canonical Tag to each page referencing itself?

              Hey Mozers! I've noticed that on www.Zappos.com they have a Canonical tag on each page referencing it self.  I have heard that this is a popular method but I dont see the point in canon tagging a page to its self. Any thoughts?

              Intermediate & Advanced SEO | | rpaiva
              0
            • WizardOfMoz

              Redirect Search Results to Category Pages

              I am planning redirect the search results to it's matching category page to avoid having two indexed pages of essentially the same content. Example http://www.example.com/search/?kw=sunglasses
              wil be redirected to
              http://www.example.com/category/sunglasses/ Is this a good idea? What are the possible negative effect if I go this route? Thanks.

              Intermediate & Advanced SEO | | WizardOfMoz
              0
            • eukmark

              What are the effects of having Multiple Redirects for pages under the same domain

              Dear Mozers, First of all let me wish you all a Very Happy, Prosperous, Healthy, Joyous & Successful New Year ! I'm trying to analyze one of the website's Web Hosting UK Com Ltd. and during this process I've had this question running through my mind. This project has been live since the year 2003 and since then there have be changes made to the website (obviously). There have also been new pages been added, the same way some new pages have even been over-written with changes in the url structures too. Now, coming back to the question, if I've have a particular url structure in the past when the site was debuted and until date the structure has been changes thrice (for example) with a 301 redirect to every back dated structure, WOULD it impact the sites performance SEOwise ? And let's say that there's hundreds of such redirections under the same domain, don't you think that after a period of time we should remove the past pages/urls from the server ? That'd certainly increase the 404 (page not found) errors, but that can be taken care of. How sensible would it be to keep redirecting the bots from one url to the other when they only visit a site for a short stipulated time? To make it simple let me explain it with a real life scenario. Say if I was staying a place A then switched to a different location in another county say B and then to C and so on, and finally got settled at a place G. When I move from one place to another, I place a note of the next destination I'm moving to so that any courier/mail etc. can be delivered to my current whereabouts. In such a case there's a less chance that the courier would travel all the destinations to deliver the package. Similarly, when a bot visits a domain and it finds multiple redirects, don't you think that it'd loose the efficiency in crawling the site? Ofcourse, imo. the redirects are important, BUT it should be there (in htaccess) for only a period of say 3-6 months. Once the search engine bots know about the latest pages, the past pages/redirects should be removed. What are your opinions about this ?

              Intermediate & Advanced SEO | | eukmark
              0
            • mjk26

              tags inside <a>tags - is this bad?</a>

              Hi, I'm currently redesigning my website, and in many places, I've now decided to make links a little bit more obvious for the user, using tags within a <a>tag in order to make the entire block of text clickable.  I was just wondering if this could have a negative impact in the search engines.  My gut feeling is no, since I'm actually improving usability, but I guess it could have an impact on how Google looks at the anchor text?  An example of the HTML is as follows: </a> <a></a> <a></a> [Cristal Night Club Hotels <address>1045 5th Street
              Miami Beach, FL33139</address> 6.4 miles from Miami Dade County Auditorium](http://localhost:8080/frontend/venue-hotels/cristal-night-club-hotels/301022 "Hotels near Cristal Night Club") Thanks for your thoughts and comments, Best wishes Mike

              Intermediate & Advanced SEO | | mjk26
              0
            • Modi

              Is 301 redirect suggested on pagination pages

              Hi - Due to pagination the default page of site is coming in 2 url with - ?page=1/ sub-url and /sub-url is 301 a recommended solution due to this pagination urls Also - is it required to create separate title and meta description of every pagination page We are taking specifically in context of our discounts and offer section http://www.mycarhelpline.com/index.php?option=com_offers&view=list&Itemid=9

              Intermediate & Advanced SEO | | Modi
              0

            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
            Free SEO Tools
            • Domain Authority Checker
            • Link Explorer
            • Keyword Explorer
            • Competitive Research
            • Brand Authority 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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
            • Accessibility
            • Terms of Use
            • Privacy

            Looks like your connection to Moz was lost, please wait while we try to reconnect.