1

please, could you help me with my problem? I was looking for lots of exmaples (also this one: htaccess exclude one url from Basic Auth) but I'm still not able to make it working :/ I have url smth.com/databox_sync and I want to exlude this url from htaccess verification. My htaccess looks like this:

    AuthUserFile /var/www/clients/client1/web3/web/domains/akomin.cz/.htpasswd
    AuthType Basic
    AuthName "My restricted Area"

        # set an environt

ment variable "noauth" if the request starts with "/callbacks/"
    SetEnvIf Request_URI ^databox_sync noauth=1

    Order Deny,Allow
    Satisfy any
    Deny from all
    Require valid-user
    Allow from env=noauth

    RewriteEngine on
    #RewriteRule ^(.*)$ /Symfony/web/$1 [L,NE]

    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]


    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]

I'm calling this adress via cron but cron returns:

"Additionally, a 401 Authorization Required ...."

Community
  • 1
  • 1
Jan Kožušník
  • 683
  • 3
  • 16
  • 30

1 Answers1

0

Change your SetEnvIf line to this:

SetEnvIf Request_URI ^/(databox_sync|index\.php$) noauth=1

This is because you're routing everything to index.php in the last rule so databox_sync also gets routed to it.

anubhava
  • 761,203
  • 64
  • 569
  • 643