Skip to content

Commit f7efd0b

Browse files
Roy-Orbisonnicolas-grekas
authored andcommitted
Simpler example for Apache basic auth workaround
Uses a simpler regex and existing back-reference instead of reading header twice.
1 parent ef5fed4 commit f7efd0b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ServerBag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public function getHeaders()
4646
/*
4747
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
4848
* For this workaround to work, add these lines to your .htaccess file:
49-
* RewriteCond %{HTTP:Authorization} ^(.+)$
50-
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
49+
* RewriteCond %{HTTP:Authorization} .+
50+
* RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
5151
*
5252
* A sample .htaccess file:
5353
* RewriteEngine On
54-
* RewriteCond %{HTTP:Authorization} ^(.+)$
55-
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
54+
* RewriteCond %{HTTP:Authorization} .+
55+
* RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
5656
* RewriteCond %{REQUEST_FILENAME} !-f
5757
* RewriteRule ^(.*)$ app.php [QSA,L]
5858
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy