nginx:rewrite

Nginx rewrite

Apache mod_rewrite:

   RewriteCond %{QUERY_STRING} !^nobranding$
   RewriteCond %{REQUEST_FILENAME} ^/assets/XL/([^.]+)\.([jpegif]+)$
   RewriteCond /usr/local/www/assets-nz/XL/%1.branded.%2 -f
   RewriteRule ^/([^.]+)\.([jpeg]+)$ /$1.branded.$2

nginx:

   location /assets {

      if ($args = nobranding) {
          rewrite  ^(.+)$ /nobranding$1  break;
      }

      rewrite  ^/assets/XL/(.+)\.(jpeg|jpg|gif)  /XL/$1.branded.$2;
      root /usr/local/www/assets-nz;
      error_page  404  =  /nobranding/assets$uri;
  }


  location /nobranding/assets {
      internal;
      alias /usr/local/www/assets-nz/;
  }

Другие примеры rewrite:

  • nginx/rewrite.txt
  • Последнее изменение: 2015/09/15 01:07
  • (внешнее изменение)