LoginSignup
0
1

More than 5 years have passed since last update.

apache2.4 httpsでhtaccessを有効化するときハマった

Last updated at Posted at 2017-04-17

訂正

サーバーコンフィグ内で

<Location />
RewriteEngine On
...
</Location>

こんな感じでLocationに RewriteEngine On 書いていたのが原因だった模様。
除去したら通常通り動きました。
この状態で下記のようにVirtualHost内に RewriteOptions Inherit を書くと、ドキュメントルート内の.htaccessがLocation内に書いてあるのと同じような挙動をするようになってしまう。
RewriteRule (.*)index\.html test.html_$1 [R,L]
とかかいて実験してみた。
/index.html にアクセスすると、 /test.html_/var/www/html にリダイレクトした。要注意。
Locationディレクティブにリダイレクトを書くのはやめましょうということですね。

tldr;

<VirtualHost> セクション内に

RewriteEngine On 
RewriteOptions Inherit

を記述すること。

解説

apache2.2では上記の記述がなくてもいいっぽい。(試してない)
<Directory> セクションを別の場所で書いていて、そこでAllowOverride Allをしていた場合にはまることがある。

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1