S
S
Sergey Burduzha2017-10-13 12:45:03
Yii
Sergey Burduzha, 2017-10-13 12:45:03

How to solve CNC problem for Yii2?

In the root directory and in the web folder I created the .htaccess file
In .htaccess from the root file I registered

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%

in .htaccess from web folder
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php%

Config from config/web.php
'urlManager' => [
      'enablePrettyUrl' => true,
      'showScriptName' => false,
      'enableStrictParsing' => false,
      'rules' => [
        // ...
      ],

baseUrl = ''
The rewrite mod is enabled, apache2.conf is set to AllowOverwirite All for /var/www
As a result, links are converted, but the page is not found.
I will be glad for help)))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Sanych, 2017-10-13
@serii81

Do this in the root of the project, only change public to web And
the standard htaccess for the web folder

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question