I
I
Igor Bezlepkin2015-05-26 11:10:42
Yii
Igor Bezlepkin, 2015-05-26 11:10:42

How to setup .htaccess in YII2 for subdomain?

Hey! Set up .htaccess for subdomain
# Backend redirect
RewriteCond %{REQUEST_URI} ^/backend
RewriteRule ^backend/(.*)$ backend/web/$1 [L]
# Statics redirect
RewriteCond %{REQUEST_URI} ^/statics
RewriteRule ^statics/(. *)$ statics/web/$1 [L]
# Frontend redirect
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule ^(.*)$ frontend/web/$1
# Mobile redirect
RewriteCond %{HTTP_HOST} ^m\.site \.ru$
RewriteRule ^(.*)$ mobile/web/$1
When entering m.site.ru everything works, index.php and settings are taken from where it should be, BUT, assets, css, js does not work.
Please tell me how to set up .htaccess for assets, css, js for a subdomain.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Volegov, 2015-05-26
@EagleMoor

A separate host is not easier?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question