Redirection problem again in new rules.

Muhammad Yousuf Khan sirtcp at
Fri Apr 15 07:27:11 UTC 2016

Hi All,

Thanks for your help. Ph. Gras and Francis for your support and advice i
really appreciate that.

Ph. Gras, i tried "break" but now it is showing 404.


Sorry for the mistake in a's and b's i was typing that in general because
the context was not the URL but the problem.

>Do note that "location /x" can match anything that starts with /x; and
>if a request for /x.html returns a redirect to /x.html, you've got a loop.

Yes , i have double checked but my redirection rules are not created wrong.
so i am sure no loop is happening there.

BTW just to update you guys. i am using wordpress.

i am doing two redirections , one domain base and second URL base.

domain base is working fine however URL redirections are giving me issues.

could this be related to wordpress?


On Thu, Apr 14, 2016 at 10:04 PM, Francis Daly <francis at> wrote:

> On Thu, Apr 14, 2016 at 07:03:19PM +0500, Muhammad Yousuf Khan wrote:
> Hi there,
> > there are multiple apache redirection rules that were working
> successfully.
> > for example something like this
> >
> > Redirect 301 /aaaa/bbbbbbb /aaaaa/bbbbbb.html
> >
> > Now i have converted this rule in nginx like this
> >
> > location /aaaa/bbbbbbbb {
> > rewrite ^(.*)$ /aaaa/bbbbbbbbbb.html redirect;
> > }
> You have different numbers of a:s and b:s there, which makes it quite
> difficult to know what it is that you actually want to do.
> > now all redirection rules are keep giving error "redirection loops".
> > and when i disable the rule things back to normal. there is no
> duplication
> > happening as far as config is concern. i can confirm.
> Do note that "location /x" can match anything that starts with /x; and
> if a request for /x.html returns a redirect to /x.html, you've got a loop.
> *Possibly* you want your "rewrite/redirect" to only happen for specific
> requests; in that case, set the first argument to "rewrite" to be as
> specific as you want. Or leave the "rewrite" applying to everything,
> but have it in an exact-match location{}.
> (And if you are doing the same "rewrite...redirect" for all inputs,
> "return" may be a better directive to use instead.)
> > can you guys please advice how can i troubleshoot this and fix the issue.
> "troubleshoot" is "turn on the debug log to see, or otherwise work out,
> what you have asked nginx to do". Then compare that with what you want
> nginx to do.
> Good luck with it,
>         f
> --
> Francis Daly        francis at
> _______________________________________________
> nginx mailing list
> nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list