How to hide web/index path in YII2

So below URL

http://www.example.com/test-demo/web/index.php

i want to hide /web/index.php.

When i have enter http://www.example.com/test-demo to directly redirect to web index. How to set path alias or any other solution. I have try .htaccess and clean url but not achieve.

My .htaccess file content is

RewriteEngine on

If a directory or a file exists, use the request directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

Otherwise forward the request to index.php

RewriteRule . index.php

Thanks in advance.

try and read through here https://www.a2hosting.com/kb/developer-corner/apache-web-server/changing-the-document-root-directory or http://httpd.apache.org/docs/current/urlmapping.html#page-header

Create your own url:

$url=Yii::app()->baseUrl.‘test-demo’;