Yii2 how to configure virtual hosting?

Trying to fill a ready website on Yii2 on shared hosting.
On the LAN everything works fine, but hosting issues page "Apache 2 Test Page powered by CentOS"

1. I realized that it was because of the lack of index file
2. I searched the solution on the network, all the advise in the rut site in the file .to prescribe htaccess Options +Indexes does not help.
3. In the error log there is an entry Directory index forbidden by Options directive

Access to the configuration httpd.conf I don't have.

Yet, returned .htaccess in root in the following form:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

RewriteCond %{REQUEST_URI} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ web/css/$1 [L]
RewriteRule ^js/(.*)$ web/js/$1 [L]
RewriteRule ^images/(.*)$ web/images/$1 [L]
RewriteRule ^fonts/(.*)$ web/fonts/$1 [L]
RewriteRule ^sitemap.xml web/sitemap.xml [L]
RewriteRule ^robots.txt web/robots.txt [L]
RewriteRule (.*) /web/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php
June 14th 19 at 20:07
2 answers
June 14th 19 at 20:09
1. When you download the file .htaccess on shared hosting to point to the beginning of the file was not transferred. Renamed
2. The Directive Options +FollowSymLinks was not enabled so I put Options +SymLinksIfOwnerMatch

That's the solution!
June 14th 19 at 20:11
Good evening.
If it were not for the index page, then most likely, You would give 403 error or job yii2 ended would be a mistake.
The problem is, I think, in the settings .htaccess and urlManager.
Try the following:
1) In the root of your project put .htaccess with the following contents
<ifmodule mod_rewrite.c>
 Options +FollowSymlinks
 RewriteEngine on

<ifmodule mod_rewrite.c>
 RewriteCond %{REQUEST_URI} ^/.*
 RewriteRule ^(.*)$ web/$1 [L]

 RewriteCond %{REQUEST_URI} !^/web/
 RewriteCond %{REQUEST_FILENAME} !-f [OR]
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^.*$ web/index.php


2) In this web directory .htaccess
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

And check the website.
After these manipulations, the web directory should go from the address bar. Additional parameters for the connection resources do not need to write in .htaccess, all the resources put in and configure web AssetBundle.
If the project You have in in the following subdirectories, in the configuration file, specify the following parameter
'request' => [
 'baseUrl' => '/name_folder', // the name must be a slash
And still no(((59d51ee4c0b2f553811681.jpeg59d51eeee038f626205906.jpeg - Lafayette.Marvin commented on June 14th 19 at 20:14
the urlManager settings? - Dion77 commented on June 14th 19 at 20:17
, mod_rewrite hosting included? - Dion77 commented on June 14th 19 at 20:20
'urlManager' => [
 'enablePrettyUrl' => true,
 'showScriptName' => false,
 'rules' => [
 '/services/<service>' => 'site/view-service',
 '/prices' => 'site/price',
 '/projects/<project>' => 'site/view-project',
 '/contacts' => 'site/contacts',
- Lafayette.Marvin commented on June 14th 19 at 20:23
Checked with this https://www.templatemonster.com/help/ru/how-to-che...
Get me mod_rewrite is not enabled, because the situation has not changed. Still Apache 2 Test Page powered by CentOS - Lafayette.Marvin commented on June 14th 19 at 20:26
59d52205d21f7444080388.jpeg - Lafayette.Marvin commented on June 14th 19 at 20:29
the slashes, I think - too much.
'services/<service>' => 'site/view-service',</service>
And mod_revrite you can check much easier - phpinfo() - Dion77 commented on June 14th 19 at 20:32
the structure of the application has not changed? Same as when you install a clean yii2? - Dion77 commented on June 14th 19 at 20:35
no not changed. everything works great on dev (OpenServer) - Lafayette.Marvin commented on June 14th 19 at 20:38
not enough access rights You have.
Try to talk with the technical support of the hosting. - Dion77 commented on June 14th 19 at 20:41

Find more questions by tags YiiApachehtaccess