Answer the question
In order to leave comments, you need to log in
How to set up the cnc admin panel (backend)?
I downloaded the .htaccess file data from the forum.
Now the admin panel is available at site.ru/admin , but on this page a 404 error pops up.
The main page of the admin panel looks like this site.ru/admin/site/index, How to configure the cnc so that there are no 404 errors
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
# 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|js|images)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
RewriteRule ^(.*)$ frontend/web/$1 [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js)/
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
</IfModule>
# Если это папка или файл, открываем его
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# В противном случае перенаправляем на index.php
RewriteRule . index.php
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
//'suffix' => '.html',
'rules' => [
'' => 'site/index',
'<action>'=>'site/<action>',
],
],
'assetManager' => [
'basePath' => '@webroot/assets',
'baseUrl' => '@web/assets'
],
'request' => [
'baseUrl' => ''
]
Answer the question
In order to leave comments, you need to log in
instead of
doing
we are talking about backend/config?
Although I don't like this structure in general, I prefer the admin area on a subdomain. The framework files should be moved to a higher level than the public folder and htassess will not need to be edited.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question