G
G
gto61202016-10-12 11:04:03
Search Engine Optimization
gto6120, 2016-10-12 11:04:03

Yandex and 301 redirects are not friends?

I have a problem with the domain in Yandex webmaster. The server is configured like this:

server {
    server_name www.domain.ru;
    return 301 $scheme://domain.ru$request_uri;
}

server {
    listen       80;
    server_name  domain.ru;
}

The situation is such that Yandex does not want to accept a domain without www as the main one, but also does not want to verify it through a 301 redirect. And I really need users to see the domain without www in the address bar, since it is already very long. And Host in robots.txt does not solve the problem, if I put it without www, I get: "An inconsistent Host directive is set in the robots.txt file."
Why doesn't verification pass through 301 redirects? Variant with meta tags is not suitable.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Karabanov, 2016-10-12
@gto6120

Make robots.txt accessible without a redirect:

location  ~ ^(/robots.txt|/sitemap.xml|/sitemap_video.xml|/favicon.ico)$ {
           root /var/www/example.com/html;
        }

G
gto6120, 2016-10-12
@gto6120

The final config, which allowed us to send the verification file and robots.txt directly without a redirect:
server {
server_name www.domain.ru;
location / {
return 301 $scheme://domain.ru$request_uri;
}
location ~ ^(/robots.txt|/sitemap.xml|/favicon.ico|/yandex_verification_file.html)$ {
root /var/www/user/domain.ru;
allow all;
log_not_found off;
access_logoff;
}
}
server {
listen 80;
server_name domain.ru;
root /var/www/nikolay/domain.ru;
index index.html index.htm index.php;
location ~ ^(/robots.txt|/sitemap.xml|/favicon.ico) {
allow all;
log_not_found off;
access_logoff;
}
...
}

F
firstlena, 2016-10-20
@firstlena

In general, it is better to write such questions directly to the Webmaster's support.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question