Domanda

I am looking for solution since few hours and i can't figure out how to exlude one locatio from AuthBasic in .htaccess file. I found solutions on the internet, but they work only without RewriteRule enabled.

My .htaccess file:

SetEnv APPLICATION_ENV development
SetEnvIf Request_URI ^/api noauth=1

Order Deny,Allow
Allow from env=noauth
Deny from all
Satisfy any

AuthType Basic
AuthName "Restricted"
AuthUserFile .htpasswd
Require valid-user

RewriteEngine On
IndexIgnore */*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php

This exception works when i comment last line (with RewriteRule) but then of course rewrite engine not works which is necessary.

È stato utile?

Soluzione

Change your SetEnvIf line to this:

SetEnvIf Request_URI ^/(api|index\.php) noauth=1
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top