L
L
lolka022018-11-05 16:55:34
Nginx
lolka02, 2018-11-05 16:55:34

Why does it redirect to the c www domain?

in general, I registered the ns of the Yandex server at the registrar, added the domain to connect.yandex.ru
and there in the DNS management And set the @, www and * records, on the server in the nginx configs at the beginning I didn’t set the redirect from www To without, it automatically redirected for some reason
then put a redirect on the domain with www
if ($http_host != domain.ru ) {
return 301 http://domain.ru$request_uri;
}
the domain stopped working at
all, before everything was also done through Yandex traffic rules, there was no such problem. In which direction to dig?
nginx config

spoiler

server {
listen 80;
server_name domain.ru www.domain.ru *.domain.ru;
if ($http_host != domain.ru ) {
return 301 http://domain.ru$request_uri;
}
location ~* ^.+\.(jpg|ico|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|htm)$ {
root /home/domain/data/www/domain.ru/current/frontend/web;
access_log off;
expires 4M;
}
root /home/domain/data/www/domain.ru/current/frontend/web;
access_log /home/domain/data/www/domain.ru/prod.access.log;
error_log /home/domain/data/www/domain.ru/prod.error.log;
index index.php index.html index.htm;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ .(php|phtml)$ {
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_pass 127.0.0.1:9021;
fastcgi_index /index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
try_files $uri =404;
}
location ~ /\.ht {
deny all;
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-11-06
@shambler81

look in .htaccess
or in the engine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question