Apacheでhttpsへリダイレクト

投稿者: | 2018年3月7日

Apacheでhttpをhttpsへリダイレクトする設定です。
mod_rewriteを使います。

<VirtualHost *:80>
    ServerName www.next-hop.net
    <ifModule mod_rewrite.c>
        RewriteEngine On
        LogLevel alert rewrite:trace3
        RewriteCond %{HTTPS} off
        RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    </ifModule>
</VirtualHost>

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です