Answer the question
In order to leave comments, you need to log in
Yii2 - after setting up the cnc, css and js files fly off. What could be the reason?
I decided to set up the CNC on yii2 (openserver), I found the instruction:
1. Placed .htaccess at the root:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ web/css/$1 [L]
RewriteRule ^js/(.*)$ web/js/$1 [L]
RewriteRule ^images/(.*)$ web/images/$1 [L]
RewriteRule (.*) /web/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
'baseUrl' => '',
Answer the question
In order to leave comments, you need to log in
First, set up the virtual host to look in the web folder. Now, apparently, it looks at you one level higher, into the application and framework directory.
Manual redirection through "Domains" works in openserver (hid web and also commented out 'baseUrl' => '').
The files are by default: site.ru- >web->css->site.css like a working method.
You are building some kind of hell. Your domain should look at the web and not two levels above, then the first htaccess is not needed at all and everything will work like clockwork.
I tried at first (foolishly and inexperienced) the same approach as you. Difficulties are just beginning, and security is a big question. Just point the server to the web folder and that's it.
If there are problems with setting up the server, then just do it differently:
everything from the web folder to the root, and the entire framework to another. It remains only to correct the paths in index.php there are 6 lines.
Watch the video: https://youtu.be/hg5t5F3HdM4?list=PLOm4dl-NavgyBnt...
This is a structure for sharedhosting and when there is no other way. But it's probably easier and better to just send the domain to the web.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question