Answer the question
In order to leave comments, you need to log in
How to set up CNC in yii2 basic?
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
'urlManager' => [
'enablePrettyUrl' => true,
// 'showScriptName' => false,
'rules' => [
'login' => 'site/login',
]
],
Answer the question
In order to leave comments, you need to log in
config/web.php
$baseUrl = str_replace('/web', '', (new \yii\web\Request)->getBaseUrl());
...
'request' => [
'baseUrl' => $baseUrl,
],
'urlManager' => [
'baseUrl' => $baseUrl,
'enablePrettyUrl' => true,
'showScriptName' => false,
],
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ web/$1 [L]
</IfModule>
# Deny accessing below extensions
<Files ~ "(.json|.lock|.git)">
Order allow,deny
Deny from all
</Files>
# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question