By encoding the parameters twice it is possible to get working url with %252f, but Yii isn't doing that, and I'm not even sure if thats a good workaround.
Anyway looks like, the path format doesn't work with params that has slashes, am I correct or am I just doing something wrong?
to the apache Virtual Host (or check link for apache config and other bugs)
But like qiang says, Yii will just treat it as a forward slash which doesn’t help.
So I was wondering if there was anyway we might be able to force the urlmanager to not use path format in specific situation.
I’ve tried using Yii::app()->urlManager->urlFormat = “get”; as well as Yii::app()->urlManager->showScriptName = true; But all I ever get frome create(Absolute)Url() is something along the lines of
which does not redirect to controller/action as it should (it will just load the site index).
If it were just a matter of creating a single url i could use createPathInfo but the issue is when you are using CGridView for example it would be nice to have an easy way to have pagination and the likes switch to "get" rather than "path" format.
Well the problem here is that a dynamic form is used to run a search on content. This form sends the data as GET, and slashes are allowed (in say, searching dates). I do not know beforehand how many fields are going to be sent or which ones they are, but I do have to handle slashes in params.
Obviously this is an issue with ‘path’ format urls, but If I want to switch to ‘get’ format urls for this request as well as all pager links (in cgrid and clist), but keep path format for the rest of the site, I hit a bit of a wall.
I was wondering if there was anyway to switch from one to the other on demand. Just setting the urlManager->urlFormat to “get” dynamically gives me an url when I createUrl() that isn’t interpreted correctly by Yii on the other end.
echo $this->createUrl('controller/action',array('paramName'=>'param/value')); // working url of /controller/action/paramName/param%2Fvalue
// but as mentioned above, Yii treats %2F as a slash so my GET is corrupt
Yii::app()->urlManager->urlFormat = 'get'; //or Yii::app()->urlManager->setUrlFormat('get');
Yii::app()->urlManager->showScriptName = true;
echo $this->createUrl('controller/action',array('paramName'=>'param/value')); //non-working ?r=controller/action¶mName=param%2Fvalue
// Yii doesn't seem to care for non-path URLs because of main.php config
Do you guys see any easy solution for this? a ‘get’ url that would work would be /controller/action?paramName=param%2FValue but the URL manager does not create urls like this oddly. I was hoping we could get another urlFormat. Is there a way of setting up a custom one? I could then hopefully configure the pager’s urlmanager options.
I have to work with parameter values that have slashes in them and encountered the same problem.
The solution I use now is simply replacing ‘%2F’ with ‘/’ in the url returned by createUrl(). Now all parameters and values come through fine. So this works just fine for me right now.
My question is does anybody know if there is a (potential) problem with this solution?