How to automatically skip intermediate redirects? I've run into the issue where I end up with something like this:

about-us01 --&gt; about-us02 --&gt; about-us


The correct path is "about-us". But due to admins changing things I have ended up in a situation where there are sometimes old redirects lingering in the system. The problem is that these google says it's not good to redirect multiple times. So the above redirect is not very effective.

Is there a way that I can get Drupal 7 to automatically skip the 'middle' redirect if it knows that is only going to result in another redirect? So instead of:

about-us01 --&gt; about-us02 --&gt; about-us


I want:

about-us01 --&gt; about-us
about-us02 --&gt; about-us


In both cases of accessing the links, it must take you directly to the about-us page and not any inbetween links if it knows the true destination?
Use the Rules module with a custom  rule which looks like so (in Rules export format):

{ "rules_redirect_multiple_paths" : {
    "LABEL" : "Disallow multiple paths",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:path" ],
          "match" : "about-us\\d+",
          "operation" : "regex"
        }
      }
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "Redirect to path about-us ...",
          "type" : "error"
        }
      },
      { "redirect" : { "url" : "about-us" } }
    ]
  }
}


Some details about how to use read this rule:


Rules Event: use the "Drupal is initializing" event, to ensure that the rule gets triggered BEFORE the actual content (of a path to be redirected) is shown. If you'd use an event like "content is viewed", you'd be too late, the content "would" already be shown.
Rules Condition: verify if the path to be redirected matches any of the paths you want to be redirected, such as about-us01 or about-us02 ( * ).
Rules Actions: 


Show a message about the redirect, which is just for QA testing (feel free to remove that Rules Action after you saw it working).
Perform the actual redirect to the desired page.



( * ) Note that the actual Regular Expression I used goes a bit further: it would also perform a similar redirect for paths such as  about-us03 or  about-us456, though it would not trigger such redirect for (eg)  about-us/789. Here is an attempt to translate the various parts used in the regular expression about-us\\d+:


about-us: it must start with about-us.
\: escape character.
\d: it must be followed by a digit (anything from 0 to 9).
+: it may be followed by 1 or more of the preceding token (so one or more extra digits).


PS: If you're struggling with regular expressions, then have a look at RegExr.