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
-
301 Domain Redirect from old domain with HTTPS
My domain was indexed with HTTPS://WWW. now that we redirected it the certificate has been removed and if you try to visit the old site with https it throws an obvious error that this sites not secure and the 301 does not happen. My question is will googles bot have this issue. Right now the domain has been in redirection status to the new domain for a couple months and the old site is still indexed, while the new one is not ranking well for half its terms. If that is not causing the problem can anyone tell me why would the 301 take such a long time. Ive double and quadruple checked the 301's and all settings to ensure its being redirected properly. Yet it still hasn't fully redirected. Something is wrong and my clients ready to ditch the old domain we worked on for a good amount of time. backgorund:About 30 days ago we found some redirect loops .. well not loop but it was redirecting from old domain to the new domain several times without error. I removed the plugins causing the multi redirects and now we have just one redirect from any page on the old domain to the new https version. Any suggestions? This is really frustrating me and I just can't figure it out. My only answer at this point is wait it out because others have had this issue where it takes up to 2 months to redirect the domain. My only issue is that this is the first domain redirect out of many that have ever taken more than a week or three.
Technical SEO | | waqid0 -
Can adding thousands of new indexable URLs to my site at once be a problem?
Hi everyone, I am currently working on a project that will quickly add thousands of new indexable URLs to my site. For context, the site currently has over a million indexable pages. Is there any danger of adding a few thousand URLs at once to the site? Could it potentially affect crawlability/SEO/other pages? Thank you!
Technical SEO | | StevenLevine0 -
Should I resubmit a 301 redirected domain in Webmaster Tools
We recently switched over a .com site to a new server. The .com site had a .co.uk domain redirecting to it previously, but when the switchover happened, the .co.uk was forgotten about. We have now realised what has happened, but not before taking a hit with our rankings. The .co.uk is still indexed in Google and now that we have sorted the redirects they are pointing to the right places. My question now; is there anything further I need to do? I know that the .co.uk will soon be removed from the SERPs, but I just want to make sure I haven't forgotten anything.
Technical SEO | | Ben_Malkin_Develo0 -
301 redirect from Blogger
Hello, I have a client with a Wordpress network of blogs, each blog is owned by a different blogger. Many of them were migrated time ago from Blogger. I have seen that the way used to redirect them is a meta refresh, so no authority is being passed. I cannot find any reliable way of making a 301 from Blogger, There are some plugins, but I'm afraid of using them. Any of you have experience with this situation please? I have even thought about placing a global rel canonical before the meta refresh, but I think that here the problem is the meta refresh itself.... Thank you in advance
Technical SEO | | Juandbbam0 -
301 redirects
Hi, I am a working on a new web site, and I want to redirect all the urls of another site (on a different host) to this one. According to both hosts it is "impossible" to do this for all urls. I don't believe that to be the case, but how do I do this? And, should both sites be hosted on the same server first?
Technical SEO | | vibelingo0 -
Redirect or not to redirect
We are rebuilding a website and try to get rid of errors. The content remains exactly the same but we correct the code and make it load faster. The site has quite many backlinks and I can't decide whether to remove .html endings from the urls and 301 redirect to the new ones or leave them with the older ending. If I remove the endings how much of the link juice will be passed? Anyone any idea?
Technical SEO | | sesertin0 -
IIS Work Around 301 Redirects
We are redirecting page-level content (about 500 pages) from several sub domains to our main site. With IIS, It’s my understanding that file locations must match. For example: subdomain/pathA/filename1
Technical SEO | | DigitalMkt
mainsite/pathA/filename1 Since the sub domain files are not on the main site, this means we'd create up to 500 zero byte dummy files on the new server and replicate the sub domain directory structure. With IIS is there a work around for handling page level redirects without duplicating the file location? In the case of white papers, videos and case studies, we'll imlement directory level redirection. Thanks in advance.0 -
Why is a 301 redirected url still getting indexed?
We recently fixed a redirect issue in a website, and although it appears that the redirection is working fine, the url in question keeps on getting crawled, indexed and cached by google. The redirect was done a month ago, and google shows cached version of it, even for a couple of days ago. Manual checking shows that its being redirected, and also a couple of online tools i checked report a 301 redirect. Do you have any idea why this could be happening? The website I'm talking about is www.hotelmajestic.gr and its being redirected to www.hotel-majestic.gr
Technical SEO | | dim_d0