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. How do I 301 redirect a number of pages to one page

    How do I 301 redirect a number of pages to one page

    Technical SEO Issues
    5 3 404
    • 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.
    • Heydarian
      Heydarian last edited by

      I want to redirect all pages in /folder_A /folder_B to /folder_A/index.php.

      Can I just write one or two lines of code to .htaccess to do that?

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

        Hi Nima.

        Is this perhaps possible to do with a RedirectMatch? Something like:
        RedirectMatch 301 /folder_A/folder_B/(.*) /folder_A/index.php

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

          Nima what platform are you using?

          Is it PHP or ASP? And any specific CMS?

          With wordpress all you have to do is to install a redirection plugin and you are good to go... but if you have a normal php based website you have to write the following code in your .htaccess file.

          _Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html_

          _ Redirect 301 /oldpage2.html http://www.yoursite.com/newpage.html_[](http://www.yoursite.com/folder/)

          If you are on a ASP platform you have to look in to your IIS and then work accordingly.

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

            Its actually phpLD and I'm trying to do it with .htaccess.

            For some reason the code below didn't work for me

            RedirectMatch 301 /folder_A/folder_B/(.*) /folder_A/index.php

            AndersS 1 Reply Last reply Reply Quote 0
            • AndersS
              AndersS @Heydarian last edited by

              Strange.

              How about something like this:
              RewriteRule ^folder_B/(.*)$ /folder_A/index.php [R=301,L]

              I'm not an expert in RegEx or Rewrite rules, so there could be som errors in there 😕

              Good luck!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • 301 Domain Redirect And Old Domain to a New one including pages
                brooksmanley
                brooksmanley
                0
                2
                62

              • Advice on whether we 301 redirect a page or update existing page?
                tomwhite
                tomwhite
                0
                2
                83

              • I've consolidated other domains to a single one with 301 redirects, yet the new domain authority in MOZ is much less that the redirected ones. Is that right?
                MashBonigala
                MashBonigala
                2
                3
                232

              • 301 redirect all 404 pages
                alsvik
                alsvik
                0
                8
                3.6k

              • How does this rank? - a page that is 301 redirected
                Morris77
                Morris77
                0
                5
                279

              • How to verify a page-by-page level 301 redirect was done correctly?
                EvolveCreative
                EvolveCreative
                0
                5
                269

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

              • 301 Redirect Domain or 301 Redirect Domain + Interior Pages
                Room214
                Room214
                0
                7
                1.1k

              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