Answer the question
In order to leave comments, you need to log in
How to configure htaccess in Yii2 for a folder in the root of the site?
Hello. I have a Yii2 advanced project with current htaccess settings for fontend and backend
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# 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 (.*) /frontend/web/$1
# if frontend request
RewriteCond %{REQUEST_URI} ^/frontend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /frontend/web/index.php
# 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
RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin|uploads)
RewriteCond %{REQUEST_URI} ^/uploads
RewriteRule . /files/$1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question