redirect - Remove point after domain name in nginx -


i have detected site accessible using domain name point @ end. example "sim-portal.ru.". works , found form of domain name according w3c. need domain automatically redirected normal domain (without point) example "sim-portal.ru", because cookies don't work in "pointed" domain , links looks wrong. i've redirected www.-prefixed domain (like www.sim-portal.ru) basic domain using next rule:

server {     listen  80;     server_name  www.sim-portal.ru;     rewrite ^ http://sim-portal.ru$request_uri? permanent; #301 redirect } 

but same rule doesn't work post-pointed domain:

server {     listen  80;     server_name  sim-portal.ru.;     rewrite ^ http://sim-portal.ru$request_uri? permanent; #301 redirect } 

what doing wrong?

i've found solution myself. rule added both server {} blocks (either www.sim-portal.ru , sim-portal.ru) solve issue:

if ($http_host != 'sim-portal.ru') {     return 301 http://sim-portal.ru$request_uri; } 

but don't forget restart nginx!


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -