S
S
Solleo2016-05-14 23:51:23
Yii
Solleo, 2016-05-14 23:51:23

Why does yii2 return 404 for many web services?

Hello. Moved yii2 basic application to hosting. I want to add a site to Yandex. Webmaster. When adding, I get a response from the server 404, the same with Google Search Console. Although the site works great. I get the same thing on some other services.
Yii2 deployed trail. way: In the root directory of the domain - everything except the web folder. The web folder itself is expanded into public_html.
For clarity, I am attaching some configs:
dacfb042c20d4ddc80757538f00e20ad.png.htaccess

Options +FollowSymLinks
IndexIgnore */*

RewriteEngine on
RewriteCond %{HTTPS} =off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

RewriteCond %{REQUEST_URI} (.*/[^/.]+)($|\?)
RewriteRule .* %1.html [R=301,L]
RewriteRule ^(.*)/$ /$1.html [R=301,L]

web.php UrlManager
'urlManager' => [
        'class' => 'yii\web\UrlManager',
    
        // Disable index.php
        'showScriptName' => false,
    'enableStrictParsing' => true, 
        // Disable r= routes
        'enablePrettyUrl' => true,
        'rules' => array(
            'contact.html' => '/site/contact',
            'index.html' => 'site/index',
            'add.html' => 'ad/index',
            'ad/subcat.html' => 'ad/subcat',
            '<slug:[\w\-]+?>.html' => 'site/index',
            '<slug:[\w\-]+?>/<adid:\d+>.html' => 'ad/view',
            '<slug:[\w\-]+?>/<slug2:[\w\-]+?>.html' => 'site/index',
            '<slug:[\w\-]+?>/<slug2:[\w\-]+?>/<adid:\d+>.html' => 'ad/view',
        ),
        ],

Link to the site: https://kerchboard.ru
Thanks in advance for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-05-14
@solleo

The site works fine, but the response code is really 404.
Try adding '' => 'site/index',
PS in the rules. You have strange redirects:
https://kerchboard.ru/detskij-mir -> kerchboard.ru/detskij-mir.html -> https://kerchboard.ru/detskij-mir.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question