Redirecting from mysite.com to www.mysite.com

Juan Fco. Giordana juangiordana at gmail.com
Thu Sep 18 23:44:28 MSD 2008


Do you have this server block also defined?

server {
    server_name   www.mysite.com;
                  ^^^^
}

You're probably falling on an infinite loop.

Thomas wrote:
> On my local dev machine, here is my /etc/hosts file:
> ---
> 127.0.0.1 localhost mysite.com www.mysite.com
> ---
> 
> 
> And in my Nginx config file I have:
> ---
> server {
>   server_name   mysite.com;
>   rewrite ^/(.*) http://www.mysite.com/$1 permanent;
> }
> ---
> 
> 
> But when I want to access mysite.com or www.mysite.com I get the
> following error message:
> ---
> Firefox has detected that the server is redirecting the request for
> this address in a way that will never complete.
> ---
> 
> 
> What could possibly go wrong?
> 






More information about the nginx mailing list