How to handle potentially thousands (50k+) of 301 redirects following a major site replacement
-
We are looking for the very best way of handling potentially thousands (50k+) of 301 redirects following
a major site replacement and I mean total replacement.Things you should know
Existing domain has 17 years history with Google but rankings have suffered over the past year and yes we know why. (and the bitch is we paid a good sized SEO company for that ineffective and destructive work)
The URL structure of the new site is completely different and SEO friendly URL's rule. This means that there will be many thousands of historical URL's (mainly dynamic ones) that will attract 404 errors as they will not exist anymore. Most are product profile pages and the God Google has indexed them all. There are also many links to them out there.
The new site is fully SEO optimised and is passing all tests so far - however there is a way to go yet.So here are my thoughts on the possible ways of meeting our need,
1: Create 301 redirects for each an every page in the .htaccess file that would be one huge .htaccess file 50,000 lines plus - I am worried about effect on site speed.
2: Create 301 redirects for each and every unused folder, and wildcard the file names, this would be a single redirect for each file in each folder to a single redirect page
so the 404 issue is overcome but the user doesn't open the precise page they are after.
3: Write some code to create a hard copy 301 index.php file for each and every folder that is to be replaced.
4: Write code to create a hard copy 301 .php file for each and every page that is to be replaced.
5: We could just let the pages all die and list them with Google to advise of their death.
6: We could have the redirect managed by a database rather than .htaccess or single redirect files. Probably the most challenging thing will be to load the data in the first place, but I assume this could be done programatically - especially if the new URL can be inferred from the old.Many be I am missing another, simpler approach - please discuss
-
Sorry to hear of your woes.
Depending on the structure of the URLS you could create some simple pattern matches rules within .htaccess? If you could a few dozen rules could handle many thousands of redirects. If there isn't any easily identifiable pattern to match then a DB will, indeed, be your best option.
One of the web devs I used to work with (who was considerably smarter than me) faced a similar issue (with a 'mere' 10k+ redirects) and used some Ruby on Rails middleware as a redirector: This may have been the solution he used:
https://github.com/vigetlabs/redirector
I hope that helps.
I hope you're able to get this sorted without too much pain. Good Luck!
-
Thank for the very quick response - you have picked my favourite solution. It will be interesting to hear other views and comments.
-
Hi,
1. Usually won't work and with 50k extra rules in your htaccess file it will for sure slow down the site as for every request to your server it has to go through the htaccess file.
For now I would recommend going with 6. with the information that you've provided. By doing it like this you can do a very quick check on your database and also in the request have the user send to the right page.
Martijn.
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
-
Improve Site Performance by Removing/Replacing Widgets & Plugins?
We completed a Wordpress redesign of our website in December. The project took about 8 months. Important URLs on the new site are performing slowly according to Google Page Speed Insights. For instance, a key product page gets a score of 18 on mobile and 61 on desktop. Home page scores 37 on mobile and 80 on desktop. My new SEO believes the website is hindered by an excessive number of plugins and widgets. That reducing the number of these may increase performance. Also, my developers were unable to get WT3 Total Cache to work with our InMotion server and have used about 3 plugins for cache. We purchased a real estate theme (wpcasa) and heavily customized it. Any suggestions for improveing performance? If we recoded the website from scratch without a pre existing theme (using the existing design) would that speed up performance? Is there anything we can do remove complexity and improve URL download speeds? We are in a very competitive niche and we need decent performance in order to rank. Thanks,
Intermediate & Advanced SEO | | Kingalan1
Alan1 -
301 Redirect from query string to new static page
If i want to create a redirect from a page where the slug ends like this "/?i=4839&mid=1000&id=41537" to a static, more SEO friendly slug like "/contact-us/", will a standard 301 redirect suffice? Thanks, Nails
Intermediate & Advanced SEO | | matt.nails0 -
Pages that did NOT 301 redirect to the new site
Hi, Is there a tool out there that can tell me what pages did NOT 301 redirect to the new sites? I need something rather than going into google.com and typing in site:oldsite.com to see if it's still indexed and if it's not 301 redirecting.. I'm not sure if screaming frog can do that. Thanks.
Intermediate & Advanced SEO | | ggpaul5620 -
Multiple 301 redirects and old site content appearing in Google results
I have found that for some Google searches the old version of the site on a completely different domain is appearing on page one of the results, while the newer site is only on page 3. The old site is redirecting to the new site with a 301 redirect, however there is also an additional redirect on the new site to force SSL. Despite this when you view the Google cache of the result that appears in Google the content of the page is still the old site. Is this normal or is Google not following the chain of 301 redirects? Edit: I just found out that downloading the page by right clicking a link and clicking download rather than viewing it in a browser leads to the old site appearing and the 301 redirect not being followed.
Intermediate & Advanced SEO | | freshleafmedia0 -
After 301 redirects average rankings went down a little. Any idea?
We have changed the design of a website, from an oscommerce site to a new responsive website with customized programming. After the 301 redirects we have lost 1 to 2 positions in Google Rankings of the most visited categories. This are real data <colgroup><col span="5" width="80"></colgroup>
Intermediate & Advanced SEO | | teconsite
| page | brand | page | CTR | average position |
| old | fagor | http://www.electrorecambio.es/tienda/fagor-m-41.html | 15% | 6,6 |
| new | fagor | http://www.electrorecambio.es/fagor | 13% | 7,2 |
| old | teka | http://www.electrorecambio.es/tienda/teka-m-39.html | 12% | 7,2 |
| new | teka | http://www.electrorecambio.es/teka | 9% | 8,8 |
| old | balay | http://www.electrorecambio.es/tienda/balay-m-81.html | 12% | 7,4 |
| new | balay | http://www.electrorecambio.es/balay | 11% | 8,6 |
| old | bosch | http://www.electrorecambio.es/tienda/bosch-m-44.html | 10% | 7,4 |
| new | bosch | http://www.electrorecambio.es/bosch | 8% | 11 | Edited: As this table is not shown properly I have added an image For you to check the old page you can see the old urls in the folder tienda2. For example http://www.electrorecambio.es/tienda/bosch-m-44.html can be checked in http://www.electrorecambio.es/tienda2/bosch-m-44.html I would like to know if you see any important information that could justify this drop down in rankings Thanks!!! data-webmaster-tools.jpg1 -
301 Redirecting Multiple Domains
I have several complete websites with blogs setup for different geo locations and was considering forwarding them all to one domain directly would greatly benefit ranking. The blogs are all linked together and that is where most of the links come from. Would I benefit in 301 Redirecting the domains?
Intermediate & Advanced SEO | | WindshieldGuy-2762210 -
Will thousands of redirected pages have a negative impact on the site?
A client site has thousands of pages with unoptimized urls. I want to change the url structure to make them a little more search friendly. Many of the pages I want to update have backlinks to them and good PR so I don't want to delete them entirely. If I change the urls on thousands of pages, that means a lot of 301 redirects. Will thousands of redirected pages have a negative impact on the site? Thanks, Dino
Intermediate & Advanced SEO | | Dino641 -
Are there any negatives to channeling my links through a 301 redirect?
I'm channeling 1000's of links through another url with a 301 redirect. I've thought this through and can't see any downside to doing this, but I want to get your opinion. Can you see any downside to doing this? With regards to passing anchor text, PR, PA, etc? Since this is done with sites all the time when they change urls, I can't see Google being able to penalize me for this....can you? What do you think?
Intermediate & Advanced SEO | | Brian-M0