基本身份验证后的重定向/重写

问题描述 投票:0回答:1

首先为我的英语不好对不起。

所以我在带有Apache的树莓派PI上有一个Openhab系统。我有一个具有两个组Admin和Users的基本身份验证,我想将“用户”重定向到打开的登录页面,以便在使用基本身份验证登录到Loggin后重定向到UI页面。问题是我不能使用PHP脚本。

所以我尝试使用.htaccess重定向用户

.htaccess:

<Location />
RewriteEngine ON
RewriteCond %{REMOTE_USER} =Elias
RewriteRule ^start/index /basicui/app
</Location>

但是所以它不起作用,我还没有找到任何可以解决这个问题的东西

.htaccess mod-rewrite basic-authentication openhab
1个回答
0
投票

我有解决方案

 RewriteCond %{REQUEST_URI} ^\/start\/index$
        RewriteCond %{REMOTE_USER} =Username
        RewriteRule .* http://openhab.clubdrei.com/basicui/app [R=302,L]
        RewriteCond %{REMOTE_USER} =Username
        RewriteRule .* http://openhab.clubdrei.com/basicui/app [R=302,L]
© www.soinside.com 2019 - 2024. All rights reserved.