Reputation: 1456
When I set the base url as example.com/ it shows only the home page in all urls. Like it masks the url with homepage in all links of the site. But when its set to '/' it works well. But with using '/' as base url breaks some link. So I want to use base url as my domain name.
'components' => [
'request' => [
'baseUrl' => 'http://example.com/',
'csrfParam' => '_csrf-frontend',
],
-----
----
]
Upvotes: 0
Views: 190
Reputation: 22174
According to docs baseUrl
is:
The relative URL for the application.
https://www.yiiframework.com/doc/api/2.0/yii-web-request#$baseUrl-detail
"relative" means that it should not contain a host name. You probably need to set hostInfo
:
'components' => [
'request' => [
'hostInfo' => 'http://example.com',
'csrfParam' => '_csrf-frontend',
],
// ...
]
Upvotes: 1