How to redirect all URLs of all terms in a specific vocabulary to custom URLs I am a newbie to Drupal and having hard time to understand how to redirect all URLs for all terms in a specific vocabulary to custom URLs.

I have tried to use Entity Path, but it did not work for me. By some reasons this module sets automatic alias field empty in a term edit form. This breaks Pretty Path module that I am also using.

I have also tried to implement custom hook as described here, but cannot understand how to make it work only for a specific vocabulary, the hook applies to all vocabularies on my site.

I would be greatly appreciate if someone can provide a step-by-step instruction to solve this issue.

edit after I tried to get it to work via Rues

Here is exported Rules

{ "rules_redirect_an_old_path_to_a_new_path" : {
    "LABEL" : "Redirect Categories Terms to Custom Path",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "existing_vocabulary_alias/[term:name]" } }
    ],
    "DO" : [ { "redirect" : { "url" : "custom_text\/custom_text\/[term:name]" } } ]
  }
}
The Rules module is your friend to implement such redirects ... 

Here is the rule you'd need for it (in Rules export format, just use copy/paste it to import it in your own setup via the Rules UI):

{ "rules_redirect_an_old_path_to_a_new_path" : {
    "LABEL" : "Redirect an old path to a new path",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:url" ],
          "match" : "the_old_path",
          "operation" : "starts"
        }
      }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "Sorry, the old path (= /the_old_path) is no longer in use, you will be redirected automatically to its corresponding path (= /the_new_path)" } },
      { "redirect" : { "url" : "the_new_path" } }
    ]
  }
}


A few more tweaks to make it fit your exact scenario:


change all occurences of the_old_path to your old path corresponding to [term:vocabulary]/[term:name].
change all occurences of the_new_path to your new path corresponding to CUSTOM_WORDS/CUSTOM_WORDS/[term:name].


Attention (1): when applying those 2 changes above, you want to do so using the Views UI. So that you are sure that you'll use the exact Rules syntax, e.g. using "tokens" that the Rules module makes available. But also know that sometimes it's a bit tough and/or tricky to get that right.

Attention (2): it could well be that the Rules condition (with that text_matches) has to be replaced by something using a "regular expression" (instead of that starts in my sample).

Whenever such redirect actually happens, the user will also receive an informational message like so:


  Sorry, the old path (= /the_old_path) is no longer in use, you will be redirected automatically to its corresponding path (= /the_new_path)


If you don't want such message to appear, then just delete the line containing drupal_message in the exported rule above.