E
E
Elizaveta Krasova2021-04-04 00:24:58
Yii
Elizaveta Krasova, 2021-04-04 00:24:58

How to fix an error with a 404 page that does not work for urls with Russian letters?

Hello. Hope someone can suggest a solution to my problem.

The site has a 404 page, which users get to by an incorrect URL. The problem is this: if a person writes something like this https:/domen.ru/fdfdf in the address bar, he will go to the site page with a 404 error, if he writes https:/domen.ru/aevaiv, he will go to a page with such content.

What could be causing this and how can it be fixed?
6068dc72095e9486447914.png

Page code:

<?php

use app\helpers\BlocksHelper;
use app\helpers\LangVar;
use app\helpers\ViewsHelper;
use yii\helpers\Html;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */

if ($exception instanceof yii\web\HttpException) {
    $code = $exception->statusCode;
    $this->title = $code;
} else {
    $code = $exception->getCode();
    $this->title = $name;
}

$this->params[ViewsHelper::PARAM_HTML_CLASS] = 'error-page';
?>
<div id="error-page-box" style="background-image: url('<?= Url::base() ?>/i/page-banner.jpg')">
    <div class="align-m">
        <div class="container">
            <?= $code > 0 ? '<span class="num">' . $code . '</span>' : '' ?>
            <h2><?= $code == 404 ? LangVar::get('page_not_found') : $name ?></h2>
            <?= $code == 404 ? BlocksHelper::get('error_404_test') : '<p>' . nl2br(Html::encode($message)) . '</p>' ?>
        </div>
    </div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question