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 @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
                          • Moving site from html to Wordpress site: Should I port all old pages and redirect?
                            Linda-Vassily
                            Linda-Vassily
                            0
                            2
                            56

                          • Help Setting Up 301 Redirects from Coldfusion Site to Wordpress Site.
                            MarketHubb
                            MarketHubb
                            1
                            3
                            143

                          • 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

                          • 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 Domain or 301 Redirect Domain + Interior Pages
                            Room214
                            Room214
                            0
                            7
                            1.1k

                          • Does 301 redirecting a site multiple times keep the value of the original site?
                            debi_zyx
                            debi_zyx
                            0
                            3
                            692

                          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