Answer the question
In order to leave comments, you need to log in
How to correctly write related rewrite conditions in nginx server settings?
Good afternoon.
Repeatedly tried to find answers on habré and documentation on nginx - alas, I did not find it.
The essence of the problem is that it is not clear whether it is possible to write something like this on nginx:
RewriteCond %{REMOTE_HOST} ^host1.* [OR]
RewriteCond %{REMOTE_HOST} ^host2.* [OR]
RewriteCond %{REMOTE_HOST} ^host3.*
RewriteRule ...some special stuff for any of these hosts...
set $host_uri $host$request_uri;
if ($host_uri ~ bla-bla){
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
Answer the question
In order to leave comments, you need to log in
nothing is clear from your question.
It is clear that you want to optimize the huge colossus of Bitrix. Redirects - 5%, or even less, what is there to optimize?
Here's another thread for you :)
here it is
set $host_uri $host$request_uri;
if ($host_uri ~ bla-bla){
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
server {
listen 80;
server_name host1.blabla.com;
location / {
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
}
server {
listen 80;
server_name host2.blabla.com;
location / {
#другое правило итд
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question