M
M
Mark2017-10-03 05:03:46
Yii
Mark, 2017-10-03 05:03:46

How to configure .htaccess in Yii2 so that a certain folder does not fall under the rules?

Hello. There was a problem with .htaccess.
In the root directory there is a directory called "dtf". And the problem is, when I go to the following path site.name/dtf/ymi - the main page of the site itself is displayed to me (which was frontend/web/site/index before.
.htaccess content:

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/(backend/web|admin)
RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L]

RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin(.*) /backend/web/$1 [L]

RewriteCond %{REQUEST_URI} ^/frontend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /frontend/web/index.php [L]

RewriteCond %{REQUEST_URI} ^/backend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /backend/web/index.php [L]

How to solve this kind of problem? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2017-10-03
@MarkLb

Add 3rd line RewriteCond %{REQUEST_URI} !^/(dtf) :

RewriteCond %{REQUEST_URI} !^/(backend/web|admin)
RewriteCond %{REQUEST_URI} !^/(dtf)
RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question