An application I’m working with has the page structure setup such so that when you create a new page and view it, the URI is:
http://site.com/page/open/title/Contact Us
A client has requested that we need shortened urls, so for example the prior URI should be something like http://site.com/contact-us/
The reason why there’s a generic page controller is because these pages have editable content regions in an admin area and it’s much easier controlling them with this type of structure.
In regards to the request of shortening them, how should I go about this? Should I, for example, create controllers for each of the 20 pages and somehow reroute them, or setup some method in my initial page controller as a shortcut to open/title/ such as page/name/Contact Us? I would think that relying on custom rewrite rules is a dirty solution and I shouldn’t need to use any, perhaps I’m wrong?
By the way, some of these pages will also have custom dynamic content such as forms, so they’re not all purely html/static. Any advice is appreciated.
you must create "slug" for page title. it’ll be like ‘contact-us’ and save it
then use standart router functionality
something like this
or u can do like stackoverflow including page_id in url and optional slug part
like
EDIT