简体   繁体   中英

Apache - AliasMatch and htaccess authentication

I am trying to setup an simple aliasmatch for apache http(s) server. 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.

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. 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.

my Directory directive

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

my .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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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