RewriteEngine のURL書き換えを親ディレクトリ優先にする

他の.htaccessオプション同様、複数の .htaccess で mod_rewrite でURL書き換えを行うとサブディレクトリ優先になります。
メンテナンス状態にしたい時など、ドキュメントルートの.htaccessを差し替えるだけでサイト内の全てのコンテンツを不可視にしたい場合はこれでは困るので、調べてみたところ、RewriteOptions という設定がありました。
 
サブディレクトリでURL書き換えを行う .htaccess に以下のように
RewriteOptions inherit を追加すると、親ディレクトリ優先になりました。

RewriteEngine on
RewriteOptions inherit
RewriteRule .* http://www.ecoop.net/ [L]

 
RewriteOptions のマニュアルを日本語訳してみたので、ご参考下さい。

The RewriteOptions directive sets some special options for the current per-server or per-directory configuration. The Option string can currently only be one of the following:

inherit
This forces the current configuration to inherit the configuration of the parent. In per-virtual-server context, this means that the maps, conditions and rules of the main server are inherited. In per-directory context this means that conditions and rules of the parent directory’s .htaccess configuration are inherited.

Rules inherited from the parent scope are applied after rules specified in the child scope.

 (訳:
RewriteOptions ディレクティブは、記述箇所によって個別のサーバやディレクトリごとの設定を行うための特別なオプションです。オプション文字列は今のところ下記のひとつしかありません。
 
inherit
このオプションは現在の設定について強制的に親の設定を受け継ぐようにします。バーチャルサーバごとのコンテキストなら、これはメインサーバーのマッピングや条件、ルールを継承するという意味になります。ディレクトリごとのコンテキストなら親ディレクトリの条件やルールを継承します。
 
親のスコープから継承したルールは子のスコープで指定したルールの後に適用されます。
)

 
参考:
mod_rewrite
URLを書き換えろ!Apache Rewrite 機能の応用