Hello everybody!
I have a problem with URL. I want to create a website that allows users to create his own and smart webpage.
The url of the webpages of my clients would look like: wepage.com/clientusername, not webpage.com/controller/action/parametername/parametervalue
the webpages of my clients are just views.
Could I set a domain name to webpage/clientusername?
How can I do it?
Thanks a lot!
In your app’s config:
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
// uncomment if necessary
//'<controller:\w+>/<action:\w+>/<id:[\-\d]+>'=> '<controller>/<action>',
//'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'<client:\w+>/<view:\w+>' => 'default/page?client=<client>&view=<view>',
),
'showScriptName' => false,
),
The last rule will translate an URL like:
webpage.com/clientusername/somePage
into:
webpage.com/default/page?client=clientusername&view=somePage
I assume that you have a controller called DefaultController with an action called actionPage that takes two arguments.
Then you load a specific page for a specific client.