Nginx doesn't redirect www no m in Safari, iPhone, iPad

ramsoft75 nginx-forum at nginx.us
Mon Jul 6 08:52:51 UTC 2015


Good day

There was a problem in testing in the terminal with the character "!", it
should be with "\" after, like this :

$ curl -A iPad -i
http://www.domain.com/#\!/pt/--item-view/en/3190/Wok-Vintage

And the result was :

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Mon, 06 Jul 2015 08:50:10 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: http://m.alpha.centroproduto.com/

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

And in this case i changed the nginx configuration to :

if ($http_user_agent ~* '(iPhone|iPod|iPad|Android|BlackBerry|webOS|Windows
Phone)') {
           rewrite ^/$ http://m.domain.com/$1 permanent;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260033,260071#msg-260071



More information about the nginx mailing list