Deploying basic Yii2 App

I deployed my Yii2 basic application on a shared hosting, but I’m facing this problem:

It happens even when I extract the web directory in the root, it gives "/index.php" instead of "/web/index.php".

But it seems that index.php is read by the server, because when I change (for example) the database config, it gives a db error.

Files access mod are on ‘644’ and directories on ‘755’. mywebsite.com/web/index.php show this error:

When I change index.php to ‘777’, the error become on the two paths: (“mywebsite.com/web/index.php” and “mywebsite.com/web”)

Inspite of moving web directory to root you can use .htaccess under the web directory that can help you set up easily with any hassle





RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php




You need to read this:

http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html