Skip to content

Commit

Permalink
add per-domain redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Jun 13, 2023
1 parent 357270b commit e4823ff
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 3 deletions.
56 changes: 54 additions & 2 deletions config/nginx/conf.d/prod.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,64 @@
server {
listen 443 deferred http2 reuseport ssl;
listen 443 http2 reuseport ssl;
#listen 443 quic reuseport;
#add_header Alt-Svc 'h3=":443"; ma=86400';

server_name favor-group.ru spb.favor-group.ru tula.favor-group.ru;
server_name favor-group.ru;

root /web/prod;
access_log /var/log/nginx/prod.access.log main if=$not_logging;
error_log /var/log/nginx/prod.error.log;

# process the redirects, regional and global
if ($new_uri_msk != "") {
return 301 https://$new_uri_msk;
}
# process the redirects map file
if ($new_uri != "") {
return 301 https://$host$new_uri;
}

include bitrix.conf;
}

server {
listen 443 http2 ssl;
#listen 443 quic reuseport;
#add_header Alt-Svc 'h3=":443"; ma=86400';

server_name spb.favor-group.ru;

root /web/prod;
access_log /var/log/nginx/prod.access.log main if=$not_logging;
error_log /var/log/nginx/prod.error.log;

# process the redirects, regional and global
if ($new_uri_spb != "") {
return 301 https://$new_uri_spb;
}
# process the redirects map file
if ($new_uri != "") {
return 301 https://$host$new_uri;
}

include bitrix.conf;
}

server {
listen 443 http2 ssl;
#listen 443 quic reuseport;
#add_header Alt-Svc 'h3=":443"; ma=86400';

server_name tula.favor-group.ru;

root /web/prod;
access_log /var/log/nginx/prod.access.log main if=$not_logging;
error_log /var/log/nginx/prod.error.log;

# process the redirects, regional and global
if ($new_uri_tula != "") {
return 301 https://$new_uri_tula;
}
# process the redirects map file
if ($new_uri != "") {
return 301 https://$host$new_uri;
Expand Down
18 changes: 17 additions & 1 deletion config/nginx/conf.d/redirects-map.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# region-specific rewrites, should include hostname in the new uri
map $request_uri $new_uri_msk {
default "";
/montag/fasadnye-raboty/ventiliruemogo-fasada/ favor-group.ru/montag/fasadnye-raboty/;
}

map $request_uri $new_uri_spb {
default "";
}

map $request_uri $new_uri_tula {
default "";
/montag/fasadnye-raboty/ventiliruemogo-fasada/ spb.favor-group.ru/montag/fasadnye-raboty/ventiliruemogo-fasada/;
~^/montag/([^?]*)? favor-group.ru/montag/$1;
}

# rewrites for all sites
map $request_uri $new_uri {
default "";
# external links
Expand Down Expand Up @@ -32,7 +49,6 @@ map $request_uri $new_uri {
~^/metallocherepitsa /catalog/krovlya/metallocherepitsa/;
/montag/krovelnye-raboty/faltsevoy-krovli/onlayn-kalkulyator-dlya-rascheta-krovli/ /montag/krovelnye-raboty/faltsevoy-krovli/;
~^/montag/krovelnye-raboty/krovli-iz-cherepitsy/ /montag/krovelnye-raboty/krovli-iz-naturalnoy-cherepitsy/;
/montag/fasadnye-raboty/ventiliruemogo-fasada/ /montag/fasadnye-raboty/;
~^/montazh-cherdachnyh-lestnic/ /montag/cherdachnykh-lestnits/;
~^/montazh-krovli/montazh-metallocherepicy/ /montag/krovelnye-raboty/metallocherepicy/;
~^/montazh-krovli/ /montag/krovelnye-raboty/;
Expand Down

0 comments on commit e4823ff

Please sign in to comment.