To way we create a Drupal rule for redirect the anonymous user to multiple different external URL.
1. Create a custom module and create a new rule by following steps :
Part 1: Defining the Event, Condition, and Action
- Define the Rules Event by using hook_rules_event_info().
- Define the Rules Condition using hook_rules_condition_info()
- Define the Rules Action using hook_rules_action_info().
Part 2: Coding the custom Event, Condition, and Action
- Event: Here we need to call package_bought to activate the rule
- Condition: It will help the event to call based on criteria, for our case "anonymous user" visit the page
- Action : redirect the page to to external link set in the content type "Redirect" fields {{ field_redirect }}
2. Create Rule in drupal backend
Configuration > rules > add new rule > give the rule name select option from "react the event" > set event , action, conditions
in our case we should select save node and condition will be the content type "Redirect"
Using this field we can redirect the anonymous user to external link based on {{ field_redirect }}
I am waiting for further discussion, Ping me at your time
Thank You