Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Redirecting www to non-www with Varnish installed?

$
0
0
Hello, before I installed Varnish, I was redirecting the www version of my domain to the non-www version with the following code:

server {
server_name www.example.com;
rewrite ^(.*) http://example.com$1 permanent;
}

and in my main server block I had:

server_name example.com;

However, now that I have installed Varnish, I get a too many re-directs error or something. I've had to disable these bits of code and change the second bit of code to:

server_name localhost; and use it like this.

How do I make www redirect to non-www now?

Thanks.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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