Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created May 23, 2016 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/4b377a8a4d492bfc787304eebab27c89 to your computer and use it in GitHub Desktop.
Save kurozumi/4b377a8a4d492bfc787304eebab27c89 to your computer and use it in GitHub Desktop.
【CodeIgniter】.htaccessと.htpasswdで任意のページにベーシック認証を掛ける方法
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
# http://domain/adminページのみベーシック認証を掛ける
<Files admin>
AuthName "admin"
AuthType Basic
AuthUserFile /var/www/html/codeigniter/public/.htpasswd
require valid-user
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment