Hi everybody,
I wanna add some word (like ‘rahmat’) beginning of any url in my web site.
And get this word from anywhere.
For example:
domain.com/rahmat/controller/view
domain.com/rahmat/controller/view/id
Hi everybody,
I wanna add some word (like ‘rahmat’) beginning of any url in my web site.
And get this word from anywhere.
For example:
domain.com/rahmat/controller/view
domain.com/rahmat/controller/view/id
there is something called ‘module’ in Yii.
basically it’s web-app inside your web-app. it’s the way of organizing/grouping your functionality in the scope of a module.
one of features I love about Yii.
then your URL would look like: {module-name}/{controller-name}/{action-name}
would that work for you?
Also you can do it by configuring routing rules (or even creating class-based rules that preprocess this word somehow).
See routing documentation for details.
thank you for your answer,
but I alredy have some modules,
and I dont want having module named with this word,
I want get this to variable or paramName.
is there any way to do ?
I have googling but couldn’t find right solution.
All I want is that
domain.com/<slug>/mymodule/mycontroller/myview
or domain.com/<slug>/mycontroller/myview
or domain.com/<slug>/other_urls
in that case <slug> = ‘someword1’ or <slug> = ‘someword2’
is there rule in URLManager like
'rules' => array(
'/<slug:(someword1)>/requestedURL' => 'site/redirect/key/<slug>',
),