I have a requirement that all urls have a variable at the end and all resolve to the same controller/view
so for example we have the following URL’s:
http://example.com/users/joe
http://example.com/users/sam
http://example.com/users/jack
All three URLS should resolve to the same controller, where I would apply some logic to render each page differently based on the username.
How can I achieve this type of routing on WordPress?
you can use a rewrite for this…link to your controller file in the last function and call the view from there.
dont forget to visit the permalinks page and save (this flushes the rewrite rules).