in this urlManager’=>array() add ‘showScriptName’=>false, than removed script name if you want to change name based on read from table and something else add ‘rules’=>include(‘route.php’),and make same file under config folder. it is look live below
Slug / Permalinks are generated separately to ensure that they are unique.
If you have any unique column into table which you’re gonna use for generating urls, then you can use it directly.
I couldn’t understand:
Do you mean you’re gonna make urls from many tables? Doesn’t seem good, but if its needed, may be a work around of having a separate table with minimum required columns like id, table_reference, slug and so on can be created and used for url creation.
Thus, a separate model representing that table could act as custom URL Rule class and moreover can also check slugs periodically for its existence or may be for redirecting to another slug with permanent redirection.
I have many models that need similar editable slugs for urls (work/title+of+work, person/name+of+person, news/2012/10/18/title+of+the+news+item). Pretty much similar functionality as in WordPress.
At first save the slug is created automatically, and then there is the option of changing the name of the slug while editing the model. Since the slug should be unique, I will use that as a permalink, too.