Last active
April 1, 2016 08:10
-
-
Save alexaandrov/6a0e76e335172cd22413d5ceb883bb87 to your computer and use it in GitHub Desktop.
Yii2 htaccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Basic package | |
Options +FollowSymLinks | |
IndexIgnore */* | |
RewriteEngine on | |
# Если запрос не начинается с web, добавляем его | |
RewriteCond %{REQUEST_URI} !^/(web) | |
RewriteRule (.*) /web/$1 | |
# Если файл или каталог не существует, идём к /web/index.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /web/index.php | |
#------------------------------------------------------------------ | |
### Advanced package | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment