D
D
Dmitry Kim2017-09-06 12:15:51
Yii
Dmitry Kim, 2017-09-06 12:15:51

Once again about htaccess for yii2 advanced?

Advanced template, admin panel at /admin . I use this htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^/admin
    RewriteRule ^admin(.*) /backend/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 [L]

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

    RewriteCond %{REQUEST_URI} \.(htaccess|htpasswd|svn|git)
    RewriteRule \.(htaccess|htpasswd|svn|git) - [F]
</IfModule>

Everything works, with one exception: links like http://domain.name/( console|common|vendor|environments ) issue circular redirects, but I would like to redirect to frontend/web/index.php to form a 404 page. My actions?
PS: listing all folders is not an option. You need something like: if the request is not going to the frontend/web and not to the backend/web, then go to hell .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question