<-
Apache > HTTP サーバ > ドキュメンテーション > バージョン 2.2 > モジュール

Please note

This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

Apache モジュール mod_version

翻訳済み言語:  en  |  ja  |  ko 

説明:バージョン依存の設定
ステータス:Extension
モジュール識別子:version_module
ソースファイル:mod_version.c
互換性:Apache 2.0.56 以降で使用可能

概要

様々なバージョンの httpd の異なる設定を扱うことになる、 テストスイートや大規模ネットワークでの使用のために設計されています。 このモジュールは新しいコンテナ ― <IfVersion> を 提供します。これを使うと、数字の比較や正規表現による柔軟な バージョンチェックができるようになります。

<IfVersion 2.1.0>
# current httpd version is exactly 2.1.0
</IfVersion>

<IfVersion >= 2.2>
# use really new features :-)
</IfVersion>

詳細は以下を読んでください。

ディレクティブ

top

<IfVersion> ディレクティブ

説明:バージョン依存の設定を入れる
構文:<IfVersion [[!]operator] version> ... </IfVersion>
コンテキスト:サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess
上書き:All
ステータス:Extension
モジュール:mod_version

<IfVersion>httpd のバージョン が基準を満たしたときにのみ実行させたいディレクティブを囲みます。 通常の (数値) 比較のときは version 引数は major[.minor[.patch]] という 形式、例えば、2.1.02.2 となります。 minorpatch は省略可能です。省略された場合は、 0 を指定したものとみなされます。比較には次の数値 operator を 指定できます:

operator説明
=== 同じ httpd バージョン
> より大きい httpd バージョン
>= 指定以上の httpd バージョン
< 指定未満の httpd バージョン
<= 指定以下の httpd バージョン

<IfVersion >= 2.1>
# this happens only in versions greater or
# equal 2.1.0.
</IfVersion>

数値比較に加えて、http のバージョン番号に対して 正規表現 による マッチングができます。二種類の書き方があります:

operator説明
= or == version/regex/ 形式
~ versionregex 形式

<IfVersion = /^2.1.[01234]$/>
# e.g. workaround for buggy versions </IfVersion>

マッチングの否定を表現するために、すべてのオペレータは前に 感嘆符 (!)を付けることができます:

<IfVersion !~ ^2.1.[01234]$>
# not for those versions
</IfVersion>

operator が省略されたときは = と みなされます。

翻訳済み言語:  en  |  ja  |  ko 

top

コメント

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.