Reputation: 282
I have action 'show' for showing articles in blog whose URL is: localhost/myblog/web/blog/blog/post?id=4
.
I want the URL to be localhost/myblog/web/blog/blog/post/unique/title-of-article
. How to accomplish something like this?
Upvotes: 0
Views: 41
Reputation: 1663
You must use SluggableBehavior in your model to generate the url part which is human readable. This data is saved saved to your database model. With this slug and some modifications to your controller and UrlManager rules you can create what you want.
This would be a complete tutorial and this was already answered here on Stackoverflow. If you need more detailed tutorials I would suggest to google. Multiple tutorials can be easily found like this.
Upvotes: 1