Nginx Location Regex for Double Digit Pagination

Viewed 10

Trying to set up a regex rule for giving 404 if pagination argument is bigger than 9 or double digit.

  • /forums/hottopics?page=8 - shouldn't match
  • /forums/hottopics?page=11 - should return 404
  • /forums/alltopics?page=20 - should return 404

How can I do this?

I have tried below but it doesn't work.

    location /forums/hottopics {
 if ($arg_page > 9) {
        return 404;
    }
}
0 Answers
Related