Submitted by Heather Oliver on

Have you ever wanted to redirect website users when they login to a specific page? Maybe you've sent an email to members and want them to visit a specific form or page, but don't know if they have logged in or not.

Using a destination parameter in Drupal, this can easily be done!

"www.myorganisation.com/user/login?destination=node/1"

You can also redirect to CiviCRM pages with a bit of extra work. CiviCRM adds other parameters into the url, so we need to rewrite those parameters as HTML so that they can be followed. So if you want to redirect to a contribution page, the ? needs to be rewritten as %3F and the & as %26

So, what would normally be: "www.myorganisation.comcivicrm/contribute/transact?reset=1&id=3 is now www.myorganisation.com/civicrm/contribute/transact%3Freset=1%26id=3"

So the full destination rewrite would be:

"www.myorganisation.com/user/login?destination=civicrm/contribute/transa…"

Easy!

You can see the full list of HTML url encoding references here: https://www.w3schools.com/tags/ref_urlencode.asp