M
M
McMike2018-06-28 14:22:15
Yii
McMike, 2018-06-28 14:22:15

How to make a site unavailable?

There is a working project under Yii2.
It is necessary to cover it temporarily, that all internal addresses issued the same page with access denied.
How to do?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2018-06-28
@McMike

Put a stub at the webserver config level.

D
Dmitry, 2018-06-28
@php10

https://github.com/yiisoft/yii2/blob/master/docs/g...
Read: catchAll.

D
Dmitry, 2018-06-28
@slo_nik

Good day.
You can do this (register in the configuration file)

'on beforeAction' => function($event) use ($params) {
        if(!Yii::$app->user->can('admin')){
           // закрывается доступ для некоторых действий
            if(in_array($event->action->id, $params['no_section']))
            {
                return Yii::$app->response->redirect(['main/default/no-section']);
            }
        }
        return false;
    },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question