Skip to content

Instantly share code, notes, and snippets.

@tsipiniuk
Forked from chris/nginx_pagination_fix.conf
Created September 8, 2018 10:38
Show Gist options
  • Select an option

  • Save tsipiniuk/04c36b0de16e06dd3c97e6f67e967817 to your computer and use it in GitHub Desktop.

Select an option

Save tsipiniuk/04c36b0de16e06dd3c97e6f67e967817 to your computer and use it in GitHub Desktop.

Revisions

  1. @chris chris created this gist May 5, 2009.
    13 changes: 13 additions & 0 deletions nginx_pagination_fix.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    if ($request_uri ~* ^(.+)\?page=1$) {
    set $dom_prefix $1;
    set $args '';
    rewrite ^(.*)$ $scheme://$host$dom_prefix permanent;
    break;
    }
    if ($request_uri ~* ^(.+)\?page=(\d+)$) {
    set $dom_prefix $1;
    set $page $2;
    set $args '';
    rewrite ^(.*)$ $scheme://$host$dom_prefix/p$page permanent;
    break;
    }