0

I have pages in path try/* and I would like to redirect to node/20. I tried path auto but using * is not allowed, I have to specify one by one.

Is there any module or way to redirect try/* to node/20

closed as too broad by kiamlaluno Jun 6 at 9:18

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

Use drupal current_path() and drupal_match_path() api to check the path and redirect to your defined path.

So in your case,

if (drupal_match_path(current_path(), 'try/*')) {
  drupal_goto('node/20');
}
0

You could redirect from .htaccess directly.

RewriteRule ^try/(.*)    node/20   [R=301,L]

Place the rule from above in the .htaccess file, the next line after RewriteEngine on

-1

Implement the hook hook_boot in your custom module. This hook gets invoked for every page request. In the hook you may implement the code to match the pattern of the request URI by using preg_match or by implementing the logic suggested by @manikandan kannan . You can then redirect using the code

header('Location: '.$GLOBALS['base_url'].'/node/20');

Not the answer you're looking for? Browse other questions tagged or ask your own question.