Remove Web Part From Url

Hello everyone.

I just installed yii2 basic project, i would like to remove/hide the web part from the url.

I put index.php outside the web folder i changed the include’s path in index.php, everythings works well, but unfortonetly the application can not include the site.css from web folder, i got 404 error.

I don’t know where can i change or modify the $this>head() function’s logic.

Without any modification the path of site.css is following: <link href="/cr/web/css/site.css" rel="stylesheet">

When i put index.php outside the web folder the site.css’s path is: <link href="/cr/css/site.css" rel=“stylesheet”>

but the css file is under /cr/web/css/site.css

I am sorry for my English.

You need to carefully change a bit more things if you are moving the bootstrap script and resources to work out of root. Refer the yii2-app-practical-b template which does this (you can use that directly to install and avoid doing this manually).

For example, you need to change the assets folder to move out to @web location (since its changed to root) - OR you need to change source paths in AppAsset bundle in assets folder to point to the correct css location. This is called in your view layout which generates the css.