1

I have a Yii project, where I want to have URLs like this:

http://module.project.tld/controler/action?param1=value1&param2=value2

My system understands these, and as a programer, I like it better, then the one is generated (some lines below)

I have multiple modules btw...

So when I use something like this in the controller:

$this->createUrl('controler/action', array('param1' => 'value1'));

then it becomes: /controler/action/param1/value1

I know this is the "pretty URL" what people using in public systems to create user friendly URLs, but my system can not understand it, and personally I don't like it, so here is my question:

How could I force Yii's URL generator, to create the format, what I need?

1 Answer 1

2

You can set CUrlManager::appendParams to false in your config/main.php.

    'urlManager'=>array(
        'urlFormat'=>'path',
        'appendParams'=>false,
        ...
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, I don't know how could I miss this option. I read about the problem everywhere -.-
It wasn't easy to find. Had to look at the CUrlManager source code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.