Get Silverstripe to ignore URL Segments after the first one

Silverstripe Version:
SS4
Question:

I am loading a section of a page with a ‘detail’ view via Ajax, which I want to be able to share with the format of /page/item/ . I am adding a url segment in the address bar with JS, but I want to be able to detect the shared url as well.

I am able to do this with JS easily enough, but I need Silverstripe to ignore the extra bit on the URL, as I’m getting a 404. How do I do that?

// Include any relevant code. If you have a lot of code, link to a gist instead.

Personally I would just change your pattern to /page#item :grinning_face_with_smiling_eyes: but this solution may help you out General Questions » Silverstripe CMS and here are relevant docs https://docs.silverstripe.org/en/4/developer_guides/controllers/routing/#url-handlers