301 redirect problems on site not yet moved
-
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.
-
Ah...Great news!
Glad to help and I hope the new site will do well for you
Sha
-
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!
-
Hi Wardy,
Check your Private Messages please.
Also, a couple of questions.
- Is the file called .htaccess?
- 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
-
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?
-
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
-
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> -
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
-
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
-
If you post the content of your .htaccess file we can see if there is a problem with your syntax.
Other things to remember:
-
Don't qualify your FROM or TO (when you fail over your domain the .htaccess will break the site
-
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
-
-
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
-
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?
-
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?
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Move a Wordpress Site to HTTPS with Bluehost
HI Guys, do you think that the following guide is enoght to move a bluehost wordpress site to https in a seo best practive way? https://www.shoutmeloud.com/free-ssl-certificate-bluehost-hosting.html Basically their steps are: Install SSL on Bluehost panel Install Really Simple SSL Wp Plugin Edit Your .htacess File & Add The Code For HTTP To HTTPS Redirection Update All HTTP URLs In Database To HTTPS Using Search and Replace Plugin Use Broken Link Checker plugin & use its redirection module to find links to 3rd party sites with HTTP that should now be HTTPS. Last thing to do Submit your new HTTPS site to Google Search Console & submit your sitemap. Update your profile link on Google Analytics. Update your website links on social media profiles & anywhere else they exist. This step you can do in pieces in the coming days. Read this guide to learn more about HTTP to HTTPS migration & fixing mixed content. If you disabled Who.Is guard for your domain name, you can enable it now. Do you know a better practical guide for wordrpess? in term of usefull plugins to handle the migration? Tx to everyone!
Technical SEO | | Dreamrealemedia0 -
Sudden jump in the number of 302 redirects on my Squarespace Site
My Squarespace site www.thephysiocompany.com has seen a sudden jump in 302 redirects in the past 30 days. Gone from 0-302 (ironically). They are not detectable using generic link redirect testing sites and Squarespace have not explanation. Any help would be appreciated.
Technical SEO | | Jcoley0 -
301 redirects
Hello. Our site was recently rebuilt, and we switched from using index.php in all the urls to not using it at all. We also changed the names of many of our pages. So the urls have been renamed from "example.com/index.php/old_page_name/" to "example.com/new-page-name/". While we were at it, we changed from "_" to "-" as our word separators in the urls. In the .htaccess file, we have a small block of code that strips out "index.php/" from all requests. This code redirects a request for "example.com/index.php/old_page_name/" to "example.com/old_page_name/" For your information, the code that strips out "index.php/" is: RewriteCond %{THE_REQUEST} ^GET.index.php [NC]
Technical SEO | | nyc-seo
RewriteCond %{THE_REQUEST} !/uSZWTLna/.
RewriteRule (.?)index.php/(.*) /$1$2 [R=301,L] Then we have 301 redirects from "example.com/old_page_name/" to "example.com/new-page-name/" QUESTION 1: Is this two-step redirect approach okay, or would it be better to skip the separate index.php stripping code and simply have 301 redirects that include "index.php" in the urls? QUESTION 2: Will we lose some of the benefit of the links that have to pass through a 301 redirect? QUESTION 3: We have 50 or so redirects. Will this affect performance of the site? How many redirects does it take to start affecting performance? Thank you!0 -
301 redirect all 404 pages
Hi I would like to have a second opinion on this. I am working on an ecommerce website that they 301 redirect all 404 pages (including the URLs entered incorrectly) to the “All categories page”. Will this have any negative SEO impact?
Technical SEO | | iThinkMedia0 -
Need Help writing 301 redirects in .htaccess file
SEOmoz tool shows me 2 errors for duplicate content pages (www.abc.com and www.abc.com/index.html). I believe, the solution to this is writing 301 redirects I need two 301 redirects 1. abc.com to www.abc.com 2. /index.html to / (which is www.abc.com/index.html to www.abc.com) The code that I currently have is ................................................... RewriteEngine On
Technical SEO | | WebsiteEditor
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule (.*) http://www.abc.com/$1 [R=301,L] Redirect 301 http://www.abc.com/index.html http://www.abc.com ...................................................... but this does not redirect /index.html to abc.com. What is wrong here? Please help.0 -
How to create a delayed 301 redirect that still passes juice?
My company is merging one of our sites into another site. At first I was just going to create a 301 redirect from domainA.com to domainB.com but we decided that would be too confusing for customers expecting to see domainA.com so we want to create a page that says something like "We've moved. please visit domainB.com or be redirected after 10 seconds". My question is, how do I create a redirect that has a delay and will this still pass the same amount of juice that a regular 301 redirect would? I've heard that meta refreshes are considered spammy by Google.
Technical SEO | | bewoldt0 -
301 redirect dropped page rank
Hi, We have a www domain that I have changed to a non www domain. The www domain had been in place for some time and had a good page rank, PR4. After this change the page rank dropped significantly (PR0, and now recently back to PR2) despite it being a 301 redirect which I thought "should" carry over the page rank. Yes, I am aware I should have just left it be. Hind sight 20/20 .. ya ya ya 🙂 My questions Is the 301 the correct method for this? Why did the page rank drop despite the 301? Should we go back to the www domain at this point? Thanks Kris
Technical SEO | | adriot0 -
How should 301 redirects affect Page Authority?
We recently setting up 301 redirects from one of our sites so that the site redirects from the www version to the non-www version for all pages. We want to quantify what we expect to see as results. From what the experts say, we'd expect that the Page Authority of the canonical versio (non-www) will be higher than either of the two separate ones were previously. For instance, if this page - www.website.com/information/ - had a PA of 57 and this one - website.com/information/ - had a PA of 53, some time after the 301 redirects from www to non-www have been put into place, we should see the non-www version of that page move up to some PA about 57. It our thinking correct? How long does it normally take to see a PA update take place in a scenario like this? Thanks, Richard
Technical SEO | | LDS-SEO0