A
A
Alexander2015-06-02 02:01:27
Yii
Alexander, 2015-06-02 02:01:27

How to set up CNC in yii2 basic?

.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

config/web.php in components Added
'urlManager' => [
            'enablePrettyUrl' => true,
//            'showScriptName' => false,
            'rules' => [
                'login' => 'site/login',
            ]
        ],

For some reason I can't set up my cnc. I pass test.local/login and there is no result

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Belikov, 2015-06-03
@kentuck1213

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]

P
Puma Thailand, 2015-06-02
@opium

'<action:login>' => 'site/<action>'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question