首页 > 解决方案 > 如何从基本身份验证中排除一个 url

问题描述

使用 Apache/2.4.41。试图从基本身份验证中排除 1 个 URL。我想排除的 URL 是/index.php?r=admin/remotecontrol我尝试了许多不同的方法来指定它,但没有一个对我有用。这是我的 .htaccess 文件:

<IfModule mod_rewrite.c>
    RewriteEngine on

    # if a directory or a file exists, use it directly
    RewriteCond %{REQUEST_FILENAME} !-f

    # otherwise forward it to index.php
    RewriteRule . index.php
</IfModule>

AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/httpd/.htpasswd
Require expr %{REQUEST_URI} =~ m#.*/remotecontrol#
Require valid-user

我错过了什么或做错了什么?

标签: apache.htaccess

解决方案


推荐阅读