Tobia
Tobia

Reputation: 9506

How to manipulate URL param in Slim 4 Framework?

I'm using Slim4 for my website and my routes have this format:

http://mywebsite/page/{pageid}

For SEO purposes I want to switch them to

http://mywebsite/page/{pageid}_free_text
for example:
http://mywebsite/page/123465_my_page_title

Of course I have many other routes with this root:
http://mywebsite/page/{pageid}_free_text/comments
http://mywebsite/page/{pageid}_free_text/comment/{commentid}/view

...

I would like to not refactor all my callbacks param handling but just replace at once with a regular expression the param named "pageid" from 123465_my_page_title to 123456, so I can keep all callbacks as they are.

Is it possibile to do it somehow? Is it possibile to manipulate the params array maybe with a Middleware?

Upvotes: 0

Views: 20

Answers (0)

Related Questions