E
E
Evgeny Popov2020-02-14 17:17:12
Apache HTTP Server
Evgeny Popov, 2020-02-14 17:17:12

What is the correct syntax for an If-statement in apache2?

apache2.4 introduces if branch statements.
In order not to produce the same virtual hosts, I decided to make one, but use the branch operator in different parts.
There is such a site:
< VirtualHost *: 80 *: 8001 >
In it I write the expression:
< If "%{SERVER_PORT} == '8001'" >
Redirect .......
< /If >
But the redirect works on both ports . If you write !=, then the redirect does not work on any port. How to check the port? On the official site in the documentation I did not find examples with ports.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-02-14
@awakewithadawn

do not invent a bicycle from scratch.
You need to generate configs for each site. Therefore, this whole hat too.
All your ifs must be in the generator template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question