简体   繁体   English

Apache-AliasMatch和htaccess身份验证

[英]Apache - AliasMatch and htaccess authentication

I am trying to setup an simple aliasmatch for apache http(s) server. 我正在尝试为Apache HTTP服务器设置一个简单的aliasmatch。 The aim is to allow to reach mydomain.com/myfiles/ with any url like mydomain.com/myfiles*/ without using url rewriting I am using a .htaccess file to require an authentication. 目的是允许使用任何URL(例如mydomain.com/myfiles*/)访问mydomain.com/myfiles/,而无需使用url重写。我正在使用.htaccess文件进行身份验证。

My problem is : When I add the AliasMatch directive, the url is recognize but I receive the error 403 forbidden without receiving the authentication popup window asking for user/password for the basic url as well as for the aliases. 我的问题是:当我添加AliasMatch指令时,URL被识别,但是我收到403 forbidden接收的错误403 forbidden而未收到要求基本URL以及别名的用户/密码的身份验证弹出窗口。 What am I missing ? 我想念什么?

I tried almost all syntax I could think about around this 我尝试了几乎所有可以想到的语法

AliasMatch "^/myfiles(.*)" "/myfiles/$1"

In the global conf as well as in the virtualhost conf. 在全局conf以及virtualhost conf中。

my Directory directive 我的Directory指令

<Directory /xxx/xxx/xxxx/myfiles>
   AllowOverride Authconfig
   Require all denied
</Directory>

my .htaccess 我的.htaccess

AuthType Basic
AuthName "Password Required"
AuthUserFile "/xxxx/xxx/xxx"
Require valid-user

myfiles is a symlink and working fine when there is not the AliasMacth directive. myfiles是一个符号链接,如果没有AliasMacth指令,则可以正常工作。

您的AliasMatch语法应为AliasMatch“ ^ / myfiles(。*)$”“ / real / path / to / myfiles / $ 1”,并带有'$'和'real-path',请尝试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM