portalzine

portalzine / Alternative to Basic Auth

Last active 12 hours ago

Like 0

Simple .htaccess Alternative to Basic Auth

portalzine revised this gist 12 hours ago · ddae55d

No changes

portalzine revised this gist 12 hours ago · c34ac7f

1 file changed, 7 insertions

basic_auth_alternative.txt (file created)
@@ -0,0 +1,7 @@
1 + RewriteEngine On
2 +
3 + RewriteCond %{QUERY_STRING} !^access_key=my-password$ [NC]
4 + RewriteCond %{HTTP_COOKIE} !access_key=my-password
5 + RewriteRule ^ - [R=511,L]
6 +
7 + Header set Set-Cookie "access_key=my-password; path=/; Max-Age=3600; HttpOnly; Secure; SameSite=Strict"