D
D
decenter2015-08-06 10:48:04
Yii
decenter, 2015-08-06 10:48:04

How to set up rules for a single GET parameter in URLManager yii 1.1.8?

There is one project functioning on yii 1.1.8, which is already a couple of years old. In fact, this is a large catalog of objects. A lot of parameters are automatically generated there by means built into Yii (standard settings). And therefore, for each option, writing your own rule will affect the performance of the application and there will be quite a few points.
Example from configuration file
array(

'components'=>array(

'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(

),
),
),
);
All urls look like this:
Site.ru/controller/action/ param1/value1/ param2/value2/ param3/value3/ …/uniq_param/uniq_value
Site.ru/controller/action/ param1/value1/ param2/value2/uniq_param/uniq_value
Site.ru/controller/ action/ param1/value1/ uniq_param/uniq_value
It is necessary that the get parameter uniq_param is not converted to the UrlManager.
Those. Urls had the form regardless of the number of parameters in it, while the uniq_param parameter would always be displayed as a get variable.
Site.ru/controller/action/ param1/value1/ param2/value2/ param3/value3/ …/?uniq_param=uniq_value
Site.ru/controller/action/ param1/value1/ param2/value2/?uniq_param=uniq_value
Site.ru/ controller/action/param1/value1/?uniq_param=uniq_value
The description in the rules of not all parameters will cause duplicate pages of the site and have a bad effect on its indexing. For example
'rules'=>array(

' controller/action /param1/< param1>'=>' controller/action ',
' controller/action /param1/< param1>/param2/< param2>/param3/< param3> /'=>' controller/action ',
)
Will lead to URL generation
Site.ru/controller/action/ param1/value1/ param2/value2/ param3/value3/?param4= value4&….&uniq_param=
uniq_value pages in the index.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question