Difference between #145 and #146 of
Yii v2 snippet guide

Revision #146 has been created by rackycz on Oct 6, 2019, 9:38:15 PM with the memo:

web folder
« previous (#145) next (#147) »

Changes

Title unchanged

Yii v2 snippet guide

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
Note that **Yii::$app->request->baseUrl** returns "/myProject/web". No trailing slash.

**How to redirect web to subfolder /web**
---
Yii 2 has the speciality that index.php is hidden in the web folder. I didnt find in the official documentation the important info - how to hide the folder, because user is not interested in it
? ... Our demo applicatinon is placed in folder:
- C:\xampp\htdocs\basic\web\index.php
[...]
```

... it only adds the word "web" into all URLs. But first we have to remove the word from URLs. Open file config/web.php and find section **request**. Add attribute
 **baseUrl**:

```
[...]
],
```
Now things will work for you. But it might be needed to use different value for devel and producti
cve web locationenvironment.

I will test this and if I find problems and solutions I will add them.

**Auto redirection from login to desired URL **
---
[...]
7 0
4 followers
Viewed: 274 857 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: a year ago
Update Article

Revisions

View all history