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. Redirects for new website

    Redirects for new website

    Technical SEO Issues
    3 2 67
    • 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.
    • JSimmons17
      JSimmons17 last edited by

      Hi Moz community,
      I'm a fairly new SEO Specialist with a brand new website.  We initially had a very basic holding website until the fully functional website was completed.  I have to do some redirects as we have both .html and .php files & we don't want to lose SEO value for specific pages (like the index, news, etc).  I also want to redirect from a www url to a non-www url.

      I am trying to accomplish redirects with the following code:

      RewriteEngine on
      RewriteCond %{HTTP_HOST} ^www.mywebsite.com [NC]
      RewriteRule (.*) http://mywebsite.com/$1 [R=301,L]

      RedirectMatch 301 /index.html (.*).(php|html) http://mywebsite.com/index.php

      RedirectMatch 301 /cupcakes-slideshow/glutenfree-slideshow.html (.*).(php|html) http://mywebsite.com/gluten-and-glutenfree.php

      RedirectMatch 301 /press.html (.*).(php|html) http://mywebsite.com/news-and-reviews.php

      Please let me know if I am on the right track.  Thanks so much in advance!

      1 Reply Last reply Reply Quote 0
      • customerparadigm.com
        customerparadigm.com last edited by

        Yes, there are two main ways to do something like this.

        My recommendation would be based on how many actual pages you need to redirect, and if you want to redirect everything, or if you want to redirect only a few pages here and there.

        Option 1.  Redirect everything using programming.

        The first way, is to use a rewrite rule like this:
        RewriteRule ^/blog/(.*)$ http://blog.subdomain.com/$1 [R=301,L]

        ... that will redirect things programatically.  Your syntax seems to be okay, but I'd test it out to make sure it's working properly.

        Advantages: One or two lines, and you're done!
        Disadvantages: You are redirecting everything, and you can't test each and every line easily.

        Option 2. Belt and Suspenders Method.

        The second way is what I like to call the belt and suspenders method.  It is not elegant.  But the theory is that if you wear both suspenders and a belt, chances are good that you won't have your pants fall down.

        This option creates a rewrite rule for each page on the site that is added to your .htaccess file.

        What's nice about this is that you can easily create these redirects, without programming, just using a sitemap page.

        I wrote a long article over on this site:
        http://www.advancedwebranking.com/blog/how-to-create-301-redirects-from-sitemap/

        ... that shows how to create these redirects quickly, without any programming (just through Excel and a text editor).

        Option 3. Use the rewrite rule, but use the method in option 2 to create a list of all of the pages that need to be redirected.

        If you'd rather, you could also use the method for creating a list of all of the pages that need to be redirected, and then use a 301 redirect checking script (there are a lot of free ones out there, just Google it), and then test if your method is working properly.

        Hope this helps!

        • Jeff
        JSimmons17 1 Reply Last reply Reply Quote 0
        • JSimmons17
          JSimmons17 @customerparadigm.com last edited by

          Thanks so much Jeff.  I will try the options you suggested.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • New website on new url?
            Carson-Ward
            Carson-Ward
            1
            7
            443

          • Website redirects
            spackle
            spackle
            0
            5
            142

          • New Website, New URL, New Content - What do we do with the old site? Are 301's the only option?
            Valarlf
            Valarlf
            0
            3
            342

          • Website Redirects
            JonathanLeplang
            JonathanLeplang
            0
            4
            236

          • I'm redesigning a website which will have a new URL format. What's the best way to redirect all the old URLs to the new ones? Is there an automated, fast way to do this?
            GregFindley.co.uk
            GregFindley.co.uk
            0
            2
            303

          • How do I resolve Twin domains? redirect website.com to www.website.com?
            sherohass
            sherohass
            0
            8
            2.3k

          • New project old domain should I 301 redirect while new sites built
            MikeDelaCruz77
            MikeDelaCruz77
            0
            3
            346

          • Can I do a redirect to a new domain name only a couple of weeks after having redirected to another domain?
            Francisco_Meza
            Francisco_Meza
            0
            4
            428

          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