1

I have old links, for example the following ones.

  • index.php/event/nr1
  • index.php/event/nr2

If users are coming on index.php/event/*, they should be redirected to /event.

How can I achieve this?

3 Answers 3

4

You can use Match Redirect module.
How to use:
1) Enable module as usual
2) Go to configuration page /admin/config/search/match_redirect
3) Add redirect settings there
enter image description here

0

Check if(!empty(arg(1))) { drupal_goto('events')}

You can write this in any of your custom module using hook modulename_init() function.

In your case the argument number may change, please do check and change the argument number.

0

There are Rewrite Rules that can be used to achieve the same thing on drupal 7 as well as on drupal 8. Use this Rewrite Rule in .htaccess file located in Drupal Root directory.

RewriteEngine on
RewriteCond %{REQUEST_URI} index.php/event/
RewriteRule ^(.*) http://www.domain.com/event [L,R=301]

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