G
G
grigorie19902017-10-01 20:02:23
PHP
grigorie1990, 2017-10-01 20:02:23

Yii2 cnc problem?

Good evening!)
CNC does not work quite correctly. I have a clean template. Uncommented the block in config/web.php

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],

And added 'baseUrl'=> '',
Thrown into the root .htaccess:
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

And in the web folder:
RewriteBase /

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

RewriteRule . index.php

As a result, the styles fell off. When I remove 'baseUrl'=> '', they are restored. The link /site/about leads to the main page and not to the web/site/about Here are some misunderstandings.
Thanks)!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maksim Fedorov, 2017-10-01
@Maksclub

  • Send Apache to look in the /site_root/web/ folder (you have Apache looking at the root, but you need to go to the web folder
    Links from the official docks -- Apache Configuration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question