Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

nginx - rewrite only www to non-www

$
0
0
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!

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>