@@ -801,6 +801,102 @@ from the web</description>
801801Locations</a ></seealso >
802802</directivesynopsis >
803803
804+ <directivesynopsis type =" section" >
805+ <name >Else</name >
806+ <description >Contains directives that apply only if the condition of a
807+ previous <directive type =" section" module =" core" >If</directive > or
808+ <directive type =" section" module =" core" >ElseIf</directive > section is not
809+ satisfied by a request at runtime</description >
810+ <syntax >< Else> ... < /Else> </syntax >
811+ <contextlist ><context >server config</context ><context >virtual host</context >
812+ <context >directory</context ><context >.htaccess</context >
813+ </contextlist >
814+ <override >All</override >
815+
816+ <usage >
817+ <p >The <directive type =" section" >Else</directive > applies the enclosed
818+ directives if and only if the most recent
819+ <directive type =" section" >If</directive > or
820+ <directive type =" section" >ElseIf</directive > section
821+ in the same scope has not been applied.
822+ For example: In </p >
823+
824+ <example >
825+ < If "-z req('Host')"> <br />
826+ ...<br />
827+ < /If> <br />
828+ < Else> <br />
829+ ...<br />
830+ < /Else> <br />
831+ </example >
832+
833+ <p > The <directive type =" section" >If</directive > would match HTTP/1.0
834+ requests without a <var >Host:</var > header and the
835+ <directive type =" section" >Else</directive > would match requests
836+ with a <var >Host:</var > header.</p >
837+
838+ </usage >
839+ <seealso ><directive type =" section" module =" core" >If</directive ></seealso >
840+ <seealso ><directive type =" section" module =" core" >ElseIf</directive ></seealso >
841+ <seealso ><a href =" ../sections.html" >How < Directory> , < Location> ,
842+ < Files> sections work</a > for an explanation of how these
843+ different sections are combined when a request is received.
844+ <directive type =" section" >If</directive >,
845+ <directive type =" section" >ElseIf</directive >, and
846+ <directive type =" section" >Else</directive > are applied last.</seealso >
847+ </directivesynopsis >
848+
849+ <directivesynopsis type =" section" >
850+ <name >ElseIf</name >
851+ <description >Contains directives that apply only if a condition is satisfied
852+ by a request at runtime while the condition of a previous
853+ <directive type =" section" module =" core" >If</directive > or
854+ <directive type =" section" >ElseIf</directive > section is not
855+ satisfied</description >
856+ <syntax >< ElseIf <var >expression</var >> ... < /ElseIf> </syntax >
857+ <contextlist ><context >server config</context ><context >virtual host</context >
858+ <context >directory</context ><context >.htaccess</context >
859+ </contextlist >
860+ <override >All</override >
861+
862+ <usage >
863+ <p >The <directive type =" section" >ElseIf</directive > applies the enclosed
864+ directives if and only if both the given condition evaluates to true and
865+ the most recent <directive type =" section" >If</directive > or
866+ <directive type =" section" >ElseIf</directive > section in the same scope has
867+ not been applied. For example: In </p >
868+
869+ <example >
870+ < If "-R '10.1.0.0/16'"> <br />
871+ ...<br />
872+ < /If> <br />
873+ < ElseIf "-R '10.0.0.0/8'"> <br />
874+ ...<br />
875+ < /ElseIf> <br />
876+ < Else> <br />
877+ ...<br />
878+ < /Else> <br />
879+ </example >
880+
881+ <p >The <directive type =" section" >ElseIf</directive > would match if
882+ the remote address of a request belongs to the subnet 10.0.0.0/8 but
883+ not to the subnet 10.1.0.0/16.</p >
884+
885+ </usage >
886+ <seealso ><a href =" ../expr.html" >Expressions in Apache HTTP Server</a >,
887+ for a complete reference and more examples.</seealso >
888+ <seealso ><directive type =" section" module =" core" >If</directive ></seealso >
889+ <seealso ><directive type =" section" module =" core" >Else</directive ></seealso >
890+ <seealso ><a href =" ../sections.html" >How < Directory> , < Location> ,
891+ < Files> sections work</a > for an explanation of how these
892+ different sections are combined when a request is received.
893+ <directive type =" section" >If</directive >,
894+ <directive type =" section" >ElseIf</directive >, and
895+ <directive type =" section" >Else</directive > are applied last.</seealso >
896+ </directivesynopsis >
897+
898+
899+
804900<directivesynopsis >
805901<name >EnableMMAP</name >
806902<description >Use memory-mapping to read files during delivery</description >
@@ -1603,31 +1699,38 @@ satisfied by a request at runtime</description>
16031699 For example:</p >
16041700
16051701 <example >
1606- < If "$ req{ Host} = '' ">
1702+ < If "-z req(' Host') ">
16071703 </example >
16081704
1609- <p >would match HTTP/1.0 requests without a <var >Host:</var > header.</p >
1610-
1611- <p >You may compare the value of any variable in the request headers
1612- ($req), response headers ($resp) or environment ($env) in your
1613- expression.</p >
1614-
1615- <p >Apart from <code >=</code >, <code >If</code > can use the <code >IN</code >
1616- operator to compare if the expression is in a given range:</p >
1705+ <p >would match HTTP/1.0 requests without a <var >Host:</var > header.
1706+ Expressions may contain various shell-like operators for string
1707+ comparison (<code >=</code >, <code >!=</code >, <code >< </code >, ...),
1708+ integer comparison (<code >-eq</code >, <code >-ne</code >, ...),
1709+ and others (<code >-n</code >, <code >-z</code >, <code >-f</code >, ...).
1710+ It is also possible to use regular expressions, </p >
16171711
16181712 <example >
1619- < If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS >
1713+ < If "%{QUERY_STRING =~ /(delete|commit)=.*?elem/" >
16201714 </example >
16211715
1716+ <p >shell-like pattern matches and many other operations. These operations
1717+ can be done on request headers (<code >req</code >), environment variables
1718+ (<code >env</code >), and a large number of other properties. The full
1719+ documentation is available in <a href =" ../expr.html" >Expressions in
1720+ Apache HTTP Server</a >.</p >
1721+
16221722</usage >
16231723
16241724<seealso ><a href =" ../expr.html" >Expressions in Apache HTTP Server</a >,
16251725for a complete reference and more examples.</seealso >
1726+ <seealso ><directive type =" section" module =" core" >ElseIf</directive ></seealso >
1727+ <seealso ><directive type =" section" module =" core" >Else</directive ></seealso >
16261728<seealso ><a href =" ../sections.html" >How < Directory> , < Location> ,
16271729 < Files> sections work</a > for an explanation of how these
16281730 different sections are combined when a request is received.
1629- <directive type =" section" >If</directive > has the same precedence
1630- and usage as <directive type =" section" >Files</directive ></seealso >
1731+ <directive type =" section" >If</directive >,
1732+ <directive type =" section" >ElseIf</directive >, and
1733+ <directive type =" section" >Else</directive > are applied last.</seealso >
16311734</directivesynopsis >
16321735
16331736<directivesynopsis type =" section" >
0 commit comments