Необходимо иметь в виду, что при использовании индексного файла делается внутреннее перенаправление и запрос может быть обработан уже в другом location’е.
index index.html;
нужен try_files.location = / {
try_files /index.html =404;
}
location / {
proxy_pass ...;
}
location = / {
rewrite ^ /index.html break;
}
location / {
proxy_pass ...;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://95.216.144.51:8080;
location @fallback {
proxy_pass http://95.216.144.51:8080;
}
location ~ ^/id/(.+) {
return 301 /?id=$1;
}
rewrite ^/id/(.+) /?id=$1 permanent;
rewrite ^/id/(.+) /?id=$1 last;
$url = '/internal_redirect/http://domain.com/?test=123&test2=234';
header("X-Accel-Redirect: " . $url);
location ~ ^/internal_redirect/(?<url>.+) {
internal;
proxy_pass $url$is_args$args;
}
rewrite ^(/*/.*)/portname=(.*) https://<ip_raritan>/dpa.asp?portname=$2&username=user&password=password last;
https://<ip_raritan>
. Тогда перенаправление будет внутренним и не будет редиректа с кодом 302 и в браузере URL не будет меняться.rewrite ^(/.*)/portname=(.*) /dpa.asp?portname=$2&username=user&password=password last;
RewriteRule ^results/$ /results.php [L]
rewrite ^/results/$ /results.php last;
server {
server_name domainname;
root /home/web/domainname/public/user;
location / {
try_files $uri $uri/ /index.html;
}
location /admin/ {
root /home/web/domainname/public;
try_files $uri $uri/ /admin/index.html;
}
}
location ~ ^/(test/[^/]+)/test2/$ {
return 301 /$1/;
}
rewrite ^/(test/[^/]+)/test2/$ /$1/ permanent;
try_files $uri $uri/ /index.html$is_args$args;
try_files $uri $uri/ /index.html =404;
location / { try_files $uri $uri/ =404; } rewrite ^/([a-z,0-9,-]+)$ /pages/$1.html last;
location / {
try_files $uri $uri/ /pages$uri-$arg_p.html /pages$uri-1.html /pages$uri.html =404;
}
rewrite ^/([a-z0-9-]+)$ /pages/$1-$arg_p.html last;
location ~ ^(/pages/.+)-\.html$ {
internal;
try_files $1-1.html $1.html =404;
}
location ~ ^/pages/.+\.html$ {
internal;
try_files $uri =404;
}
location / {
rewrite ^ /index.html break;
}
location = /api/ {
proxy_pass http://localhost:4200;
}
location / {
proxy_pass http://backend;
}
location ~ ^/(smokeping|pgadmin4) {
allow 192.168.11.0/25;
deny all;
proxy_pass http://backend;
}
location / { try_files $uri $uri/ =404; }
location / {
try_files $uri $uri/ =404;
}
location /home/downloadsites/ {
root /;
}
location / { if (!-e $request_filename){ rewrite ^/(.*) /index.php?code=$query_string; } location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } }
location / {
}
location ~ ^/dir/([0-9A-Za-z]*)$ {
try_files $uri /dir/index.php?code=$1&$args;
}
location @php {
на location \.php$ {
if ($request_uri ~ "^/catalog/search/\?q=(.*)") {
return 301 /catalog/?search=$1;
}
location = /catalog/search/ {
if ($args ~ "^q=(.*)") {
return 301 /catalog/?search=$1;
}
}
location = /catalog/search/ {
return 301 /catalog/?search=$arg_q;
}