7
8

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.

特定のファイルのみにBasic認証をかける

Last updated at Posted at 2016-11-05

特定のファイルのみにBasic認証をかける場合は以下の内容の.htaccessファイルおよび.htpasswdファイルを作成する。

.htaccess

.htaccess
AuthUserfile /<パス>/.htpasswd
AuthGroupfile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user
<Files ~ "^(<ファイル名>\.<拡張子>|<ファイル名>\.<拡張子>|<ファイル名>\.<拡張子>)$">
  satisfy any
  order allow,deny
  deny from all
</Files>

.htpasswd

.htpasswd
<ユーザー名>:<BASE64、MD5等を用いて暗号化したパスワード>
7
8
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
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?