V
V
Vyacheslav2016-10-27 23:04:27
htaccess
Vyacheslav, 2016-10-27 23:04:27

How to make routing in yii2advenced? How to include files from asset?

Good day everyone, I'm trying to figure out routes in yii2 advenced. I don't have much experience, so I apologize in advance. Questions elementary for knowledgeable people.
It costs OpenServer in which Apache 2.2 + Nginx 1.8
I use the advanced template, since the administrative part is needed.
The backend folder and all references to the backend have been renamed to admin
The site is opened by site.local site.local/site/about
Admin panel by site.local/admin/site/login
But css and js files from asset are not connected
Root htaccess settings

RewriteEngine On

# rewrite for the frontend  - основной редирект в frontend/web
RewriteCond %{REQUEST_URI} !^/(admin/web|admin)
RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L]

# rewrite for the backend - все что начинается с /admin редиректится в /backend/web
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin(.*) /admin/web/$1 [L]

# if under frontend/web file or directory exists - take it - если в frontend/web папка или файл существуют - берем их
RewriteCond %{REQUEST_URI} ^/frontend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward to index.php - все остальное отправляется на index.php во фронтенде (все что начинается с frontend/web)
RewriteRule . /frontend/web/index.php [L]

# same for backend - то же самое, но для бэкенда
RewriteCond %{REQUEST_URI} ^/admin/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /admin/web/index.php [L]

htaccess web settings
RewriteEngine On RewriteBase /

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

RewriteRule . index.php

In the configs are written
'homeUrl' => '',
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
        ],
        'request' => [
            'baseUrl' => '',
        ],

Question 1: How to include files from AppAsset?
Question 2: How to remove the controller from the CNC?
Thanks in advance.

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