redirect 301 alias domain

Maxim Dounin mdounin at mdounin.ru
Mon Mar 3 16:46:39 UTC 2014


Hello!

On Mon, Mar 03, 2014 at 10:43:01AM -0500, zuckbin wrote:

> hi,
> 
> i want to do a 301 redirect on all my alias domain for a domain
> 
> but i stuck in an infinite loop!
> 
> server{
>     listen 80;
>     server_name www.aaa.com www.aa.com ...
>     return 301 http://www.bbb.com$request_uri;
> 
> }
> 
> server{
>     listen 80;
>     server_name www.bbb.com
>     ...
>    ....
> 
> }
> 
> how to solve this ?

The configuration above should not result in an infinite loop.  
Things to check in no particular order:

- Make sure configuration you are working with is actually one 
  loaded by nginx.  That is, make sure you've done a configuration 
  reload and it was successfull.

- Make sure you aren't testing your browser's cache instead of 
  current configuration.  That is, make sure to clear cache before 
  each test.  Or, better yet, use telnet or curl for tests.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list