0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

xserverでhtaccessしててSSLしたいとき

Posted at

設定ドメインに対して、アクセス制限やリダイレクト設定が設定されている
更新完了までの間、一時的に無効にしてください。

SSLの設定&更新のたびに、.htaccess無効にしなきゃいけないの面倒ですよね。対処法です。

SSL設定時にこういうアクセスがあります。

access.log
hoge.jp **.**.**.** - - [06/May/2022:10:19:17 +0900] "GET /.well-known/acme-challenge/Hoge123Fuga456hoge789Fuga HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"

なのでこのアクセスを除外してあげればいいです。例:

.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} !letsencrypt #これを追加
    RewriteRule ^(.*)$ public/$1 [QSA,L]
</IfModule>
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?