Welcome! Log In Create A New Profile

Advanced

nginx - rewrite only www to non-www

Posted by rnk 
rnk
nginx - rewrite only www to non-www
March 26, 2013 03:06AM
I'm trying to redirect `www.example.com` to `example.com` This is my nginx rewrite rule:

server {
listen 80;
server_name www.upinbangalore.com;
return 301 http://upinbangalore.com$request_uri;
}

server {

listen 80;
server_name upinbangalore.com;

[...]

The redirection for **www to non-www** is working fine. But the problem is the other sub domain `mail.example.com` which I've set **CNAME records** to the mail server is also getting redirected to `example.com`

How could I avoid this?

This is my DNS setup in Linode.

A/AAAA Records
Hostname IP Address TTL Options
xxx.xxx.xxx.xxx Default Edit | Remove
www xxx.xxx.xxx.xxx Default Edit | Remove

CNAME Records
Hostname Aliases to TTL Options
mail go.domains.live.com Default Edit | Remove


Thanks!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 184
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready