Answer the question
In order to leave comments, you need to log in
Why files are not included in Yii2?
Hello,
I have a .htacces file at the root of the site:
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 (.*) /web/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
'baseUrl' => ''
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix' => '.html',
'rules' => [
[
'pattern' => '',
'route' => 'site/index',
'suffix' => ''
],
'<action:(about|contact|login)>' => 'site/<action>',
// '<action:about>' => 'page/about',
'<controller>/<action>' => '<controller>/<action>',
'site/hello/<name:\w+>' => 'site/hello',
],
],
Answer the question
In order to leave comments, you need to log in
The problem was in the server settings
And it was Apache-2.4-Nginx-1.7
Replace .htaccess at the root with
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/.*
RewriteRule ^(.*)$ web/$1 [L]
RewriteCond %{REQUEST_URI} !^/web
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ web/index.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question