3

I have a site is in a "web" subfolder, that is hidden with .htaccess so that people accessing http://www.example.com gets served with http://www.example.com/web/index.php .

To set this behaviour and prevent Yii2 from generating links with the "web" folder, I have set "baseUrl" to "/" in the urlManager.

Now all the pages are served right, and all the links are created correctly, but the Yii::$app->homeUrl variable has an incorrect value "//" when it should be "/", so it creates problems with login/logout.

If i remove the baseUrl it works correctly, but adding the "web" parent folder to all urls.
What am I doing wrong?

1
  • I have set baseUrl to an empty string, and it fixed this problem, but it doesn't have sense for me. Can someone explain me what's going on? Commented Aug 12, 2015 at 14:34

1 Answer 1

2

Had same trouble. I just added 'homeUrl' => '/' option to config root.

Sign up to request clarification or add additional context in comments.

Comments

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.