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. 301 redirect problems on site not yet moved

    301 redirect problems on site not yet moved

    Technical SEO Issues
    13 2 1.2k
    • 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.
    • Wardy
      Wardy last edited by

      I have re-designed one of my sites, the old site is all static pages on a Windows server, I have made the new sites and it is on a new server and is running on Wordpress.

      I have just finished testing it and so am nearly ready to switch over the nameservers to the new server, however I'm having some problems with 301 redirects.

      I have tried to set up a few 301 redirects on the new server to test before I change nameservers but they don't appear to be working. I would have imagined that they should (even though the actual page isn't hosted on the new server) or am I being very stupid here and I can't test a 301 redirect until the nameservers have been changed.

      Redirect 301 /magazines.htm http://.../~account/magazine-freebies

      Obviously the above with the stars (*) is the server address and route to my account.

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

        Hi Wardy,

        Are you saying that the domain you wish to redirect to is not yet hosted on that server or did I lose you along the way?

        Wardy 1 Reply Last reply Reply Quote 0
        • Wardy
          Wardy @ShaMenz last edited by

          Sorry, I thought as I was typing it that it might come across slightly confusing! 🙂

          www.mysite.co.uk (old versions) is still live on current hosting.

          The re-design of www.mysite.co.uk is ready and has been uploaded to a new server.

          I have not changed the nameservers of www.mysite.co.uk to point to the new server yet and so the new re-designed site can only be viewed by visiting the physical address of where it is located on the new server: http://123.12.123.12/~mysite

          However, I tried to just set up a test 301 redirect on the new server to test my 301 redirects would be working when I do change the nameservers from old to new server but they don't appear to work.

          e.g. I tried to test the 301 by

          http://123.12.123.12/~mysite/magazines.htm (no actual page there but represents  www.mysites.co.uk/magzines.htm when I do change nameservers)

          Set up 301 redirect to try and take this to http://123.12.123.12/~mysite/magazine-freebies

          So really the existing old site doesn't play any part in this as I am testing it all on the new server first?

          Does this make any more sence or made it even more confusing? 🙂

          ShaMenz Wardy 3 Replies Last reply Reply Quote 0
          • ShaMenz
            ShaMenz @Wardy last edited by

            OK, so what you are actually trying to do is redirect from one page on the new server to another page on the new server, regardless of anything that is happening on the old server?

            Sha

            1 Reply Last reply Reply Quote 1
            • ShaMenz
              ShaMenz @Wardy last edited by

              If you post the content of your .htaccess file we can see if there is a problem with your syntax.

              Other things to remember:

              1. Don't qualify your FROM or TO (when you fail over your domain the .htaccess will break the site

              2. Remember that your WordPress installation will break when you fail over your domain as it has been installed to your test domain.

              Hope that helps,

              Sha

              1 Reply Last reply Reply Quote 0
              • Wardy
                Wardy @Wardy last edited by

                Yes this is correct. Although I've tried it with the old page on the new server and with the old page not there on the new server but I can't get the re-direct to work.

                Below is the contents of my .htaccess file.

                Thankyou for your help!

                BEGIN WordPress

                <ifmodule mod_rewrite.c="">RewriteEngine On
                RewriteBase /~freefsuk/
                RewriteRule ^index.php$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /~freefsuk/index.php [L]</ifmodule>

                END WordPress

                Options +FollowSymLinks
                RewriteEngine On
                RewriteCond %{QUERY_STRING} (<|%3C).script.(>|%3E) [NC,OR]
                RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
                RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
                RewriteRule ^(.*)$ index.php [F,L]

                Options -Indexes

                protect the htaccess file

                <files .htaccess="">order allow,deny
                deny from all</files>

                protect wpconfig.php

                <files wp-config.php="">order allow,deny
                deny from all</files>

                <files wp-login.php="">Order Deny,Allow
                Deny from All
                Allow from ...*</files>

                Redirect 301 /magazines.htm http://edit/~mysite/magazine-freebies

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

                  Hi Wardy,

                  The .htaccess file is read from top to bottom and the first Rule which matches is the Rule that will be used. This means that currently, your Wordpress Rule is a "catch-all" and the 301 will never be executed.

                  So, the 301 needs to be placed above the Wordpress Rule in the .htaccess

                  Hope this helps,

                  Sha

                  Wardy 1 Reply Last reply Reply Quote 1
                  • Wardy
                    Wardy @ShaMenz last edited by

                    Thanks for the reply again Sha!

                    So I have put

                    Redirect 301 /magazines.htm http://edit/~mysite/magazine-freebies

                    at the very top of the .htaccess but the redirect still does not take place.

                    This is how it now looks. I'm sorry if I'm being daft here by the way!

                    Redirect 301 /magazines.htm http://edit/~mysite/magazine-freebiesagazine-freebies

                    Options +FollowSymLinks
                    RewriteEngine On
                    RewriteCond %{QUERY_STRING} (<|%3C).script.(>|%3E) [NC,OR]
                    RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
                    RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
                    RewriteRule ^(.*)$ index.php [F,L]

                    BEGIN WordPress

                    <ifmodule mod_rewrite.c="">RewriteEngine On
                    RewriteBase /~freefsuk/
                    RewriteRule ^index.php$ - [L]
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteRule . /~freefsuk/index.php [L]</ifmodule>

                    END WordPress

                    Options -Indexes

                    protect the htaccess file

                    <files .htaccess="">order allow,deny
                    deny from all</files>

                    protect wpconfig.php

                    <files wp-config.php="">order allow,deny
                    deny from all</files>

                    <files wp-login.php="">Order Deny,Allow
                    Deny from All
                    Allow from ...**</files>

                    ShaMenz Wardy 5 Replies Last reply Reply Quote 0
                    • ShaMenz
                      ShaMenz @Wardy last edited by

                      Hi Wardy,

                      I think we are nearly there 🙂

                      This is what the first block of your .htaccess should look like:

                      Options +FollowSymLinks
                      RewriteEngine On

                      **RewriteRule  ^/magazines.htm$ /magazine-freebies [R=301,L]**RewriteCond %{QUERY_STRING} (<|%3C).script.(>|%3E) [NC,OR]
                      RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
                      RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
                      RewriteRule ^(.*)$ index.php [F,L]

                      The rest remains the same, but you will need to remove the old rule from the end of the file.

                      Hope that helps,

                      Sha

                      1 Reply Last reply Reply Quote 0
                      • Wardy
                        Wardy @Wardy last edited by

                        Thanks again for the reply and being patient!

                        It still isn't working for me.

                        Obviosuly magazines.htm hasn't been uploaded at any point on the new server but that won't make any difference would it?

                        1 Reply Last reply Reply Quote 0
                        • ShaMenz
                          ShaMenz @Wardy last edited by

                          Hi Wardy,

                          Check your Private Messages please.

                          Also, a couple of questions.

                          1. Is the file called .htaccess?
                          2. I the page magazine-freebies a static URL or a Wordpress Blog Category Page?

                          Please make your .htaccess file look like this

                          RewriteEngine On

                          RewriteRule  ^/magazines.htm$ /magazine-freebies

                          Just these two lines, and test to see if it works.

                          Sha

                          1 Reply Last reply Reply Quote 1
                          • Wardy
                            Wardy @Wardy last edited by

                            Hi Sha,

                            yes it all works, I think my problem was because of trying it on a test server etc.

                            You have abeen a great help! 🙂

                            1 Reply Last reply Reply Quote 0
                            • ShaMenz
                              ShaMenz @Wardy last edited by

                              Ah...Great news!

                              Glad to help and I hope the new site will do well for you 🙂

                              Sha

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              • 301 redirect from sites closing down
                                JaneCopland
                                JaneCopland
                                0
                                2
                                169

                              • 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 redirecting old content from one site to updated content on a different site
                                OlegKorneitchouk
                                OlegKorneitchouk
                                0
                                2
                                207

                              • Moving articles to new site, can't 301 redirect because of panda
                                philray
                                philray
                                0
                                5
                                408

                              • Ideally should a 301 or 302 redirect be used from https://www.site.com to http://www.site.com? Is there a valid reason to use a 302 in this situation or would using a 301 have any negative impact on seo?
                                Unity
                                Unity
                                0
                                2
                                317

                              • To 301 redirect or not to 301 redirect? duplicate content problem www.domain.com and www.domain.com/en/
                                Chris-CA
                                Chris-CA
                                0
                                5
                                456

                              • 301 redirecting a mobile site.
                                inc.com
                                inc.com
                                0
                                3
                                338

                              • 301 redirect on the root of the site
                                DavidKauzlaric
                                DavidKauzlaric
                                0
                                5
                                1.0k

                              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