Answer the question
In order to leave comments, you need to log in
Yii How to redirect from backend/web/?
Hello! The question is simple, but I can not solve it in any way.
Can you tell me how to make a redirect in htaccess of all links that have backend/web. For example, when a request
crm.topjam.ru/sk-orto/backend/web/help/rating
crm.topjam.ru/sk-orto/help/rating
$baseUrl = str_replace('/backend/web', '', (new Request)->getBaseUrl());
'request' => [
'csrfParam' => '_csrf-backend',
'baseUrl' => $baseUrl
],
# deal with admin first
RewriteCond %{REQUEST_URI} ^/(assets|css|js|images)
RewriteRule ^assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ backend/web/css/$1 [L]
RewriteRule ^js/(.*)$ backend/web/js/$1 [L]
RewriteRule ^images/(.*)$ backend/web/images/$1 [L]
RewriteRule ^(.*)$ backend/web/$1 [L]
# if request begins with /admin remove admin and ad /backend/web/
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin\/?(.*) /backend/web/$1
# other requests add /frontend/web/$1
RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin)
RewriteRule (.*) /backend/web/$1
# if backend request
RewriteCond %{REQUEST_URI} ^/backend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /backend/web/index.php
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question