V
V
Vladislav Sofienko2017-10-17 14:35:27
Yii
Vladislav Sofienko, 2017-10-17 14:35:27

How to share folder and files in htaccess for Yii2?

Hello. There is a project on Yii2 advanced version and there is a standard htaccess setting.

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
 
# Если запрос начинается с /admin, то заменяем на /backend/web/
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin\/?(.*) /backend/web/$1
 
# Добавляем другой запрос /frontend/web/$1
RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin)
RewriteRule (.*) /frontend/web/$1
 
# Если frontend запрос
RewriteCond %{REQUEST_URI} ^/frontend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /frontend/web/index.php
 
# Если backend запрос
RewriteCond %{REQUEST_URI} ^/backend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /backend/web/index.php

But the desire to open:
1) convert /files to /uploads/doc
2) convert from /pdfreader to /pdfreader/web/viewer.html
3) prohibit requests ^/frontend/web/(files|pdfreader) because the rule is written in urlManager from which I can’t register the domain.com/files/... link in the iframe, since the urlManager intercepts it thinking that it belongs to the page controller'<url:\w+>' => 'page/view'
RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin|files|pdfreader)

This does not roll or I do not understand something.
Thanks in advance

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