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. Web Design
    4. Advanced 301 Redirects

    Advanced 301 Redirects

    Web Design
    3 3 254
    • 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.
    • RickyShockley
      RickyShockley last edited by

      Hi all!

      I'm moving a blog from a subdomain to a folder on my root domain and want to make sure I am properly implementing 301's. Is there a code or method for making specific pages 301 to the corresponding new URL without having to manually 301 each?

      For example, a current blog may exist at blog.website.com/3-tips-for-selling-your-home and, since we are moving the blog, will now exist at website.com/3-tips-for-selling-your-home. We obviously want to implement 301's to ensure any link equity carries over to the new url.

      Anyone know how to implement these in scale to without having to set up each manually?

      Thanks!

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

        This should do it:

        #begin redirect

        RewriteCond %{HTTP_HOST} ^subdomain.domain.com

        RewriteRule ^(.*)$ http://domain.com/subfolder/$1 [R=301]

        #end redirect

        Regex isn't the most intuitive thing in the world, but it's a necessary evil sometimes. Here's a nice little tool to help when you have to use it: http://regex101.com/

        1 Reply Last reply Reply Quote 3
        • Travis_Bailey
          Travis_Bailey last edited by

          I've been using regexpal for a while. I think I like regex101 better.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • Site redesign - 301 Redirects
            julie-getonthemap
            julie-getonthemap
            0
            4
            187

          • Should I do multiple 301 redirects?
            nhhernandez
            nhhernandez
            0
            2
            987

          • 301 Redirect Issue for URL with # and !
            BlueprintMarketing
            BlueprintMarketing
            0
            4
            2.5k

          • HTTPS redirecting to subdomain; do I need to 301 to HTTP first?
            alimo
            alimo
            0
            5
            346

          • 301 Redirect from Old Domain to New Domain
            Chris.Menke
            Chris.Menke
            0
            2
            1.3k

          • Redirects (301/302) versus errors (404)
            Cyrus-Shepard
            Cyrus-Shepard
            0
            6
            3.1k

          • 301 redirects from old site to new
            jaychow
            jaychow
            0
            3
            977

          • Display a message after 301 redirect.
            JoshPugh
            JoshPugh
            0
            5
            2.3k

          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