search

Home  >  Q&A  >  body text

nginx error: rewrite or internal redirection cycle

I added the following rewrite rule, and then an error was reported. Why is this a cycle?

location / {
        rewrite ^/(.*).html$ /.html?mode=test last;
        error_page 404 = @nodejs;
}

Didn’t I add $ at the end of the regular expression? After rewriting it once, .html is no longer at the end, and there is ?mode=test after it, so this regular expression will no longer be matched. Yeah

習慣沉默習慣沉默2749 days ago972

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-16 17:22:40

    last changed to break...

    reply
    0
  • Cancelreply