1
1

More than 1 year has passed since last update.

When you want to use SSL with htaccess on xserver

Last updated at Posted at 2023-07-27

Access restrictions and redirect settings are set for the setting domain
Temporarily disable them until the update is completed.

Link: https://www.xserver.ne.jp/manual/man_server_ssl.php

It's troublesome to have to disable .htaccess every time you set up and update SSL. It's a workaround.

There is such access when setting 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)" 

Therefore, you should exclude this access. example:

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