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
-
Unsolved Temporary redirect from 302 to 301 for PNG File?
#302HTTP #temporaryredirect
Technical SEO | | Damian_Ed 0
Hi everyone, Recently I have faced a crawl issue with my media images on website. For example this page url https://intreface.com/wp-content/uploads/2022/12/Horion-screen-side-2.png has 302 HTTP Status and the recommendation is to change it 301. I have read the article on temporary redirections here:
https://moz.com/learn/seo/redirection?_ga=2.45324708.1293586627.1702571936-916254120.1702571936
but its not written here how to redirect in my HTML 1 image url not the landing page.
Screenshot 2023-12-15 at 11.02.40.png
I have messaged to MOZ Support but they recommended to go for the MOZ Community!
Screenshot 2023-12-15 at 11.06.02.png Could you assist me wit this issue please? I can reach HTTML of the necessary page and change what I need for permanent redirection but firstly I need to understand how to do that correctly.0 -
Moving content from 1 site to another
Hi Moz'ers I have recently taken over the company I work for (www.prendas.co.uk) and want to migrate approx 200 pages from my hobby site to my company's eCommernce website on Shopify Plus. The content (text/photos) are highly relevant to the company, is unique & written by me and will hopefully generate some sales. I have a plan to gradually move them all over (I intend on doing 2-5/day) into a specific blog section to house them all. I'll then create an Apache perm. redirect to the old site too. Source: cycling-jersey-collection.com D/A 21
Technical SEO | | andystorey
Destination: prendas.co.uk D/A 35 The plan is to eventually shut the old site down. Does anybody have any best practice/and/or recommendations? Thanks in advance. Andy0 -
Console: Change Of Address, 301 Redirects Step Not Working
Hi everyone, We just made a switch to a new domain based on a rebrand, and we are currently directing users who navigate to the homepage of the old site to an interim page on our new site that reads companyname.com/companyname, that then redirects to the actual homepage of the new site, companyname.com. The redirect page's purpose is to tell users about the brand name change before showing them the new site. The challenge is that in the second step of the verification process for the address change, it reads that our domain name request does not correspond because the homepage is directing to this interim page. Is there a way for us to continue to direct people to companyname.com/companyname and have GSC verify that the 301 redirects work properly? Ideally we would not want to direct people from the homepage of the old site to the homepage of the new site. Thank you in advance for your help. Sincerely, Chase VHSpF
Technical SEO | | commcreative0 -
Site redesign. Possible SEO problems?
Hi! Our website has enjoyed good rankings for lots of our keywords for the past 9years. Over the years the site became heavy, so we want to change the design radically. Content, filenames, titles, urls etc. will all remain identical just the change of a template. The new one is minimalistic and responsive design. We are worrying this may drop our domain or page authority and kill all our past SEO efforts. **How to do this with the least harm to our rankings? Anything we need to avoid?**Articles/advice/suggestions comments on design and SEO would be greatly appreciated. Thank you for your help! Alina
Technical SEO | | skalfa0 -
Can I 301 Re-Direct within the same site?
I have a magento site and would like to do a 301 redirect from page A to page B. Page B was created after Page A but contains the same products. I want page A to be replaced in the search engines with page B while carrying the link juice from page A. Is this possible? Am I better off just blocking page A through the robots .txt file? Thanks
Technical SEO | | Prime850 -
Identifying a 301-redirect problem?
I was looking at the Search Engine Optimization reports for one of my clients in Google Analytics, and I saw that their two biggest landing pages are www.website.com and http://website.com. Does this mean that Google is serving both the 'www' and 'non-www' versions of the website, and thus harming the website's overall ranking? Thanks for any input!
Technical SEO | | williammarlow0 -
301 Redirect & re-use
I have an old site which is being moved to a new tld due to re-branding. I understand I would do a series of 301 redirects from the pages of the old site to capture the authority and move to the new site. However, at some point in the future (probably 1-2 years) we may want to re-use the old site again for a different brand (it has a good brand, just not for what we're going after). Question is - can a redirected site be re-used at some point in the future? And if so, which site would new authority (links, etc.) go to?
Technical SEO | | uwaim20120 -
Google Confusion: Two Sites and a 301 Redirect.
Hi, We have a client who just sprang a new project on us. As always, they went ahead and did some stuff before bringing us into the loop! (oh the joy of providing SEO services!) Anyway, i'm pretty swamped right now and need some extra brains on this. Basically the client had www.examplesiteA.com online for many years (an affiliate site which had built up a strong brand in the industry). They have now decided to turn this affiliate site into a full blown service platform and so with the new site being built they 301'd the whole thing over to www.examplesiteB.com - this is where they want all the old affiliate content to be hosted. So essentially examplesiteA.com is now examplesiteB.com and a new site is being placed on examplesiteA.com - still with me? So this has all happened and a brand new website is on examplesiteA.com and the old examplesiteA is now sitting exactly as it used to, but on the examplesiteB domain. The 301 redirect has been removed and the new examplesiteA seems to have been crawled, but the homepage is not indexed. When you search for examplesiteA, examplesiteB is the top result. Now they are similar domain names and to be fair I have very little data at this point i.e. I don't know when the 301 redirect was removed and it maybe that this all fixes itself with time. How is link equity effected now that examplesiteA.com was 301 redirected to examplesiteB.com and cached in this way, but now the 301 redirect has been removed and does not exist? Would link juice have been diluted throughout the process? Obviously if we had been in on all this before anything was implemented we would have done things differently. Interested to hear what others would do coming in at this point. Thanks and look forward to the advice!
Technical SEO | | MarcLevy0