Answer the question
In order to leave comments, you need to log in
Yii 2. How to change backend and frontend url?
Deployed Yii 2 with advanced application template.
At the root are two folders frontend and backend.
We configured the root via htaccess to the /frontend/web folder .
It was /frontend/web/index.php/site/index
Became /site/index - ok.
But paths to css files still remain through /frontend/web/css Is it possible to disable /frontend/web/
path generation globally in yyi2 settings (for menu items, scripts, etc.)?
Answer the question
In order to leave comments, you need to log in
Options +FollowSymlinks
RewriteEngine On
# deal with admin first
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^admin/css/(.* )$ backend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^.*$ backend/web/index .php [L]
RewriteCond %{REQUEST_URI} ^/(assets|css)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css /$1 [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css)/
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
and discard .htaccess, otherwise you will soon have to configure the same
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question