I
I
Ivan Yakushenko2016-07-11 16:04:46
PHP
Ivan Yakushenko, 2016-07-11 16:04:46

Why is the site not displaying correctly due to .htaccess?

Uploaded the layout on Yii2 version basic 2.0.8, uploaded the following .htaccess to the Yii2 root:

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 (.*) /web/%1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php

And in the web folder:
RewriteBase /

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

RewriteRule . index.php

Also, in the ./config/web.php file, I uncommented the urlManager and added 'baseUrl' => '' to the request component.
When visiting the localsite address from the site, only text is displayed, as if neither css, nor js, nor images and fronts connected, and if you go to localsite/web, the site will be displayed correctly, which is strange.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question