Forum

Thread tagged as: Runway

Runway Routing question

Struggling to get this to work, trying to change the URL in Runway.

This link currently works fine - www.domain.com/volunteering/opportunity?slug=string-of-text-123&id=123

I want to use www.domain.com/volunteering/opportunity/string-of-text-123/123

For the /volunteering/opportunity page in Runway I have this set in the Routes URL pattern and it doesn't seem to work. The wrong URL must be generated (probably without the parameters), so the data isn't found (in a database lookup) and a 404 page is therefore displayed.

volunteering/opportunity/[*:slug]/[*:id]

Can anyone tell me what's wrong with the URL pattern please?

Graham Street

Graham Street 17 points

  • 4 years ago

I think I've fixed it. The problem appears to be that the code on the page was using $_GET['id'] to retrieve one of the parameters. The code is a subset of the site and has been written by a third-party, and we are currently testing it. I've changed their code to perch_get('id') and now it works. So I assume that $_GET['id'] is not supposed to work when using Runway Routing?

Drew McLellan

Drew McLellan 2638 points
Perch Support

PHP populates $_GET with the key/value pairs after the ? in the URL. Your URL has no ? so it will be empty.

perch_get() gives you a consistent interface across both methods.

Thanks for the explanation. Problem now solved and the routing works as we need it. :-)