0

In my routes file I have this:

'micros-test/guest-booking/(?P<bookingId>[a-z0-9-]*)' => 'micros-test/guest-booking',

Which works fine for URLS like this:

/en/micros-test/guest-booking/some-valid-alphanumeric-id

However I need to add another that I can't get working, this time with a querystring value, such as this:

/en/micros-test/guest-reset-password?token=some-valid-alphanumeric-id

How can I get that to route to my endpoint and pass on the token parameter?

I've tried this but to no avail:

'micros-test/guest-reset-password/?token=(?P<token>[a-z0-9-]*)' => 'micros-test/guest-reset-password',

What have I got wrong there?

Russ Back
  • 1,503
  • 13
  • 26

1 Answers1

2

Edit - looks like it's the specific use of token as a parameter that's causing the problem.


The route doesn't need to account for the get parameters, so it only needs to be micros-test/guest-reset-password.

You then fetch the parameter using craft.request.getParam('token').

Adam Gilleard
  • 422
  • 3
  • 9