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. On-Page / Site Optimization
    4. Redirect Code Needed.

    Redirect Code Needed.

    On-Page / Site Optimization
    2 2 102
    • 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.
    • Kashif-Amin
      Kashif-Amin last edited by

      Hi,

      Please help me redirect the following pages in htaccess.

      https://www.mydomain.com/FolderA/FolderB/number-of-pages.html to

      **https://www.mydomain.com/FolderA/FolderC/FolderB/number-of-pages.html **

      I want to redirect atleast 50 pages like this.

      Please help

      Thanks

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

        Hi Kashif,

        Following this structure should get it done.

        RewriteRule ^subdirectory/(.*)$ /anotherdirectory/$1 [R=301,NC,L]

        For your example it would be like

        RewriteRule ^FolderA/FolderB/(.*)$ /FolderA/FolderC/FolderB/$1 [R=301,NC,L]

        For less then 100 redirects it "may" also be prudent to do them individually. I say this because it makes it very obvious what is going on if you ever need to edit it again. I would use Excel or OpenOffice to create a spreadsheet then just concatenate the cells together, following this example;

        Redirect 301 /path/to-old-url    https://www.mydomain.com/path/to-new-url

        Ref site: http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/

        Hope this helps,

        Don

        1 Reply Last reply Reply Quote 2
        • 1 / 1
        • First post
          Last post
        • My site auto redirects http to https. This is causing redirect chains. What can I do?
          WebQuest
          WebQuest
          0
          2
          130

        • Domain Redirection
          Roman-Delcarmen
          Roman-Delcarmen
          0
          3
          78

        • Do you need to include the top menu on every single page of the site in the code?
          BlueprintMarketing
          BlueprintMarketing
          1
          9
          55

        • Redirect and Redirect Error in Moz Crawl
          andy.bigbangthemes
          andy.bigbangthemes
          0
          4
          49

        • Redirection
          Aleyda
          Aleyda
          0
          3
          144

        • Temporary redirections
          TakeshiYoung
          TakeshiYoung
          0
          2
          60

        • Redirect
          VillasDiani
          VillasDiani
          0
          6
          68

        • Html and css errors - what do SE spiders do if they come across coding errors? Do they stop crawling the rest of the code below the error
          pab1
          pab1
          0
          3
          511

        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