Does a chain of two 301 redirects affect SEO?

Joined
Dec 28, 2019
Messages
15
Likes
6
Degree
0
Hi guys,

I'm trying to solve a redirection chain issue where old urls need to be redirected to the correct new one directly. Currently, the problem is that it is being redirected twice and possibly three times, and I'm trying to get it to be direct ie once.

For example:

Source http://www.domain.com/old-page-name
Target https://www.domain.com/new-page-name

The problem is that currently, it is taking 2 steps:

http://www.domain.com/old-page-name
https://www.domain.com/old-page-name
https://www.domain.com/new-page-name

I think the issue is that it is going from http to https at the server level, and then redirecting to the new-page-name when it gets to the redirection-plugin in WP.

This must be a common problem which is hopefully simple to solve. Or is it ok to leave it as is with two 301 hops?
 
Last edited by a moderator:
My oldest site is 10+ years so this is a common problem for me too. I think testing is the best way to get the answer you were looking for. But I could be wrong. I hope the saltier members here have a good answer to this because it has plagued me as well
 
It's easy to solve, and you should. At the same time, let me say that 2 leaps is pretty normal. Most sites do it like you're doing it, where you resolve the https & www step in one go, then the slug in the next step. If you find your self doing it in three steps where www & non-www happen first, then http to https, and then your slug, you should resolve that.

Some reasons to do it in fewer leaps/hops include saving Google the resources. If you save them time and resources, they're going to think more highly of your site.

Another reason is speed, not only for Google but for users. You know what scares people into thinking something is wrong? Seeing their URL bar go through a ton of "oh no this site is hacked" redirects.

Another reason is that if you don't fix it now, later it'll become 4 and 5 leaps. And Google will stop crawling after I think 5 leaps. They say they'll "come back later" but good luck with that.

If you want to fix it you'll need to get your redirects out of the plugin and into the .htaccess file (asuming Apache server). Then you have two options. You can try to set up some Regex to do a catch-all but that's confusing to do and confusing to read later.

What I'd recommend is before you do the http to https "global" redirect, you do your specific redirects you've created. That might look something like this:

Code:
# REDIRECTS
<IfModule mod_rewrite.c>
RewriteRule ^old-page-name/ https://yourdomain.com/new-page-name/ [L,R=301]
</IfModule>
# END REDIRECTS

This will pick up every variation like:
  • http://
  • https://
  • http://www.
  • https://www.
While also redirecting you to the correct page, in one go.

Even if you have 50 redirects lined out in the Rewrite Rules above, that's fine. If you get beyond 300 I'd reconsider how I do things in the future, because the .htaccess file has to get parsed on every page load, and you're going to slow down your whole site a wee bit eventually.

After that, you can have your normal "redirect anything else to my preferred https://www. version". Everything should happen in one redirect at that point.
 
You should charge @Ryuzaki lol seriously, thanks
 
What I'd recommend is before you do the http to https "global" redirect, you do your specific redirects you've created.
Does this mean it will still end up being 2 hops?

Thanks for the htaccess/Apache suggestion. The site's on an nginx server and I just tried to test an old to new url redirect at the server level by following https://gridpane.com/kb/some-nginx-redirect-examples/ ... but no luck. Still 2 hops.

This is the line to insert:
rewrite ^/example-uri$ /destination-uri permanent;

Which I changed to:
rewrite ^/http://domain.com/old-slug/$ /https://www.domain.com/new-slug/ permanent;

Maybe I messed up the redirect line of code.
 
Does this mean it will still end up being 2 hops?
No, because any URL with a custom redirect will come first. Any variation of it (SSL or non-SSL or www or non-www) will go straight to your desired end result you hard code in.

The 2nd “global” redirect won’t touch those because they land where it would have sent them.

Also, you didn’t follow the instructions right in your example. ^/example-uri$ doesn’t need http or https stuff on it or your domain with the .com. That’s what the ^ is for. And the $ means “end of this part of the code”. I’d explain better with examples but I’m on mobile.
 
Last edited:
No, because any URL with a custom redirect will come first. Any variation of it (SSL or non-SSL or www or non-www) will go straight to your desired end result you hard code in.
Oh good. Do you know what's the best way to achieve this in nginx ie do the custom redirects first before the global redirects?

With Gridpane, and the SSL & www/non-www settings are a simple toggle in the UI. I've managed to SSH in to create a custom redirect file, but the global settings are still executing before the custom redirect.

Also, you didn’t follow the instructions right in your example. ^/example-uri$ doesn’t need http or https stuff on it or your domain with the .com. That’s what the ^ is for. And the $ means “end of this part of the code”.
Ah, thank you. Just discovered that the redirect is being triggered elsewhere, so even though this line was wrong, the redirect still worked.

What's strange is that when I deleted this particular redirect in the Redirection plugin, and deleted this particular line in the nginx custom redirects file as well, the URL still redirected! Very strange. There's one word that's the same in the old & new slug, could WP be redirecting automatically? Went to WP settings and resaved permalinks but it didn't help.
 
@Padi, that’s probably because Wordpress stores the old slugs in the database and will redirect for you. It’s slower because it’s PHP and has to ping the database but it’s not a big deal.

I’m not directly familiar with Nginx, sorry. Same principals should apply though.
 
@Padi, that’s probably because Wordpress stores the old slugs in the database and will redirect for you. It’s slower because it’s PHP and has to ping the database but it’s not a big deal.

I’m not directly familiar with Nginx, sorry. Same principals should apply though.
You've been mostly helpful already @Ryuzaki - thank you. I'll try to fumble my way through and share an update. Just got a response from GP support that has provided a solution to get the custom redirects executed before the globals. Not sure what to make of getting so excited about figuring out a single 301 hop :smile:
 
Can we just turn this into an ongoing redirect thread? Because I have more questions. Specifically
- Should you nofollow links that are not broken but return 403 errors? Will that resolve those errors, or can I just ignore?

Context - I have affiliate links that are all 403'ing. I use Wordpress and my broken link checker wants me to do something about em. Should I just ignore these warnings since I know my visitors can access those links? Or is there a SEO penalty or performance issue that these errors cause that warrant my attention?
 
Should I just ignore these warnings since I know my visitors can access those links?
How can they access the links if they are 403'ing?
 
Dont know. But I have tested it with a circle on different platforms and the links all work. Should I be looking at this in a different way?
 
Dont know. But I have tested it with a circle on different platforms and the links all work. Should I be looking at this in a different way?
Often you'll find these affiliate links, especially those routing through tracking domains, know when it's a bot crawling or not and will throw up something other than a 301, 302, or 200 server response. They may allow Googlebot, etc. But they'll block user agents from common spidering software. If everything resolves for the user, it's fine.

But, to go back to your context, yes, you should nofollow every affiliate link every time. They're "incentivized" links. You're paid for placing them there. That's a no-no in terms of Google's Webmaster Guidelines.
 
But, to go back to your context, yes, you should nofollow every affiliate link every time. They're "incentivized" links. You're paid for placing them there. That's a no-no in terms of Google's Webmaster Guidelines.

@Ryuzaki @CCarter Big thanks. I am adding this to my SOP. With so many competing priorities I have been ignoring this for years. Hopefully this answers the same question other newbies like me might have.
 
You've been mostly helpful already @Ryuzaki - thank you. I'll try to fumble my way through and share an update. Just got a response from GP support that has provided a solution to get the custom redirects executed before the globals. Not sure what to make of getting so excited about figuring out a single 301 hop :smile:
UPDATE: Gridpane Support helped to get this resolved. Unfortunately it is a GP specific solution. In case it helps anyone, this is the response:

Code:
The issue here is that the main-context.conf adds the redirect within the https main context.
The redirect needs to be added before https main context. To do that, the redirect file needs
to be named redirect-return-www-context.conf and use the following nginx conf:

if ($request_uri ~* "(/slug/name/)"){
  return 301 [URL]https://www.domain.com/new-slug/[/URL] ;
}
 
Back