문제

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.

도움이 되었습니까?

해결책

Change your SetEnvIf line to this:

SetEnvIf Request_URI ^/(api|index\.php) noauth=1
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top