Yii can't route module's url

152 views Asked by At

I have a Yii project, with some modules. One of them is called facebook. We will use this, to manage our facebook app, but I have some trouble with the routing.

I have the following route saved, and it works only without extra parameters:

"https://facebook.domain.dev/<controller:[\w\-]+>/<action:[\w\-]+>" => "facebook/<controller>/<action>"

So this works well, until I try to add some parameters to the URL. With parameters, it only works in this format:

"https://domain.dev/facebook/site/index/id/123"
// and not with the following
"https://facebook.domain.dev/site/index/id/123"

This is a big issue, because these are different domains, even if they are using the same application. So Facebook only lets us use this, if I allow using this main domain, what I don't feel secure.

Does anyone has an idea, what can be the root of this problem?

2

There are 2 answers

0
seniorpreacher On BEST ANSWER

Yesterday I tried all the different kinds of URLs, and I think I tried the "old-school" version:

"https://facebook.domain.dev/site/index?id=123"

So this works now :)

But, the createUrl function still generates urls like in the original question.. but that's another problem...

1
Marcos Mercedes On

Take a look at this answer, I think you will be able to solve this in a better way by using HttpFilters https://stackoverflow.com/a/13291992/2101027