location ^~ /constructor {
if (...) {
}
try_files ...;
}
map $platform $front_path {
default /home/www/redesigned_spa_desktop/dist;
mobile /home/www/redesigned_spa/dist;
}
server {
location ^~ /constructor {
alias $front_path;
try_files $uri /constructor/index.html;
}
map $args $_args {
~^redirect=[^&]*&?(.*) $1;
~^(.*?)&redirect=[^&]*(&?.*) $1$2;
}
server {
location = / {
error_page 418 = @rewrite;
if ($arg_redirect ~ '^(?<_url>https?://[\w.-]+)') {
return 418;
}
}
location @rewrite {
rewrite ^ /?$_args? break;
proxy_pass $_url;
proxy_http_version 1.1;
proxy_ssl_server_name on;
resolver 8.8.8.8;
}
try_files $imgdir/$imgfile /../static$uri /../static1$uri /../static2$uri /../static3$uri @image;
DirectorySlash off
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)\.html /$1 [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/$0.html -f
RewriteRule .* /$0.html [L]
proxy_set_header Host $host;
.api.vk.com
на site.ru
и сервер вк честно отвечает что нет у него такого site.ru
.proxy_set_header Host $host;
^$
совпадает только для главной страницы.^
или $
. Тогда шаблон будет совпадать для любой страницы, в том числе и для /3.html
.RewriteCond %{THE_REQUEST} "!^\S+ /3\.html"
RewriteRule ^ /3.html [L,R=301]
RewriteCond %{REQUEST_URI} !^/3\.html$
RewriteRule ^ /3.html [L,R=301]
RewriteCond %{REQUEST_URI} !=/3.html
RewriteRule ^ /3.html [L,R=301]
RewriteRule !^3\.html$ /3.html [L,R=301]
https://site.ru/?query
RewriteCond %{THE_REQUEST} "^\S+ /\?%5B%20%D0%B2%D1%8B%D0%B2%D0%B5%D0%B4%D0%B5%D0%BC%20%D1%81%D0%B0%D0%B9%D1%82%20%D0%B8%D0%B7-%D0%BF%D0%BE%D0%B4%20%D1%81%D0%B0%D0%BD%D0%BA%D1%86%D0%B8%D0%B9%20%D0%AF%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%D0%B0%20\(%D0%B7%D0%B0%20%D0%B7%D0%B0%D0%BA%D1%83%D0%BF%D0%BA%D1%83%20%D1%81%D1%81%D1%8B%D0%BB%D0%BE%D0%BA\)%20-%20seoscout\.ru%20%5D "
RewriteRule ^ https://site.ru/? [R=301,L]
RewriteCond %{QUERY_STRING} "^%5B%20%D0%B2%D1%8B%D0%B2%D0%B5%D0%B4%D0%B5%D0%BC%20%D1%81%D0%B0%D0%B9%D1%82%20%D0%B8%D0%B7-%D0%BF%D0%BE%D0%B4%20%D1%81%D0%B0%D0%BD%D0%BA%D1%86%D0%B8%D0%B9%20%D0%AF%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%D0%B0%20\(%D0%B7%D0%B0%20%D0%B7%D0%B0%D0%BA%D1%83%D0%BF%D0%BA%D1%83%20%D1%81%D1%81%D1%8B%D0%BB%D0%BE%D0%BA\)%20-%20seoscout\.ru%20%5D$"
RewriteRule ^$ https://site.ru/? [R=301,L]
RewriteCond %{QUERY_STRING} "=%5B%20%D0%B2%D1%8B%D0%B2%D0%B5%D0%B4%D0%B5%D0%BC%20%D1%81%D0%B0%D0%B9%D1%82%20%D0%B8%D0%B7-%D0%BF%D0%BE%D0%B4%20%D1%81%D0%B0%D0%BD%D0%BA%D1%86%D0%B8%D0%B9%20%D0%AF%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%D0%B0%20(%D0%B7%D0%B0%20%D0%B7%D0%B0%D0%BA%D1%83%D0%BF%D0%BA%D1%83%20%D1%81%D1%81%D1%8B%D0%BB%D0%BE%D0%BA)%20-%20seoscout.ru%20%5D"
RewriteRule ^$ https://site.ru/? [R=301,L]
http {
proxy_cache_path /tmp/nginx_cache keys_zone=one:10m;
server {
listen 80;
server_name sandbox6.dev.ru;
location / {
return 403 ;
}
location ~ ^/api/v2/qa/diff/(?<cache_key>[0-9]+) {
proxy_pass http://test.qa.ru;
proxy_http_version 1.1;
rewrite "^/api/v2/qa/diff/(.*)" /api/push/diff/$1 break;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache one;
proxy_cache_valid 200 2h;
proxy_cache_key $scheme$proxy_host$cache_key$is_args$args;
}
}
# https://city.site.com/search/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^search/$ list.php?crt_city=%1 [L,QSA]
# https://city.site.com/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^$ st.php?crt_dealer=%1 [L,QSA]
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule (.*) index.php?q=$1 [L]
?q=
RewriteRule ^news/2021/professor-bez-shtanov\.html$ https://www.crawler.pro/news/2021/produser-dlya-marketologa/professor-bez-shtanov.html [R=301,L]
rewrite ^/url1/(url2/url3/) https://domain2.ru/$1 permanent;
if ($request_uri ~ '^/url1/(url2/url3/.*)') {
return 301 https://domain2.ru/$1;
}
RewriteCond %{REQUEST_URI} !/gorod_is_
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/gorod_is_
RewriteRule ^(.*[^/])$ $1/ [L,R=301]