Too many redirects

I’m following the wiki’s guidelines with:

server {
server_name mike.example.com;
rewrite ^ http://www.example.com$request_uri? permanent;
}

I’m getting a “this page has too many redirects error”. So I tried:

location = example.com { rewrite example.com www.example.com permanent;
}

This worked after I had gone to www.example.com but if I clear the cache
and
first go to example.com (like a first-time user) I get a “DNS lookup
failed.”

Any suggestions, thanks.


View this message in context:
http://nginx.2469901.n2.nabble.com/too-many-redirects-tp6864778p6864778.html
Sent from the nginx mailing list archive at Nabble.com.

On Wed, Oct 05, 2011 at 08:32:52PM -0700, seminal wrote:

I’m following the wiki’s guidelines with:

server {
server_name mike.example.com;
rewrite ^ http://www.example.com$request_uri? permanent;
}

I’m getting a “this page has too many redirects error”. So I tried:

location = example.com { rewrite example.com www.example.com permanent; }

This location has no sense from nginx point of view.

This worked after I had gone to www.example.com but if I clear the cache and
first go to example.com (like a first-time user) I get a “DNS lookup
failed.”

Any suggestions, thanks.

server {
server_name example.com;
rewrite ^ http://www.example.com$request_uri? permanent;
}

server {
server_name www.example.com;

}


Igor S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs