HGSSO
HGSSO

Reputation: 65

Apache location match wildcard URL

My VHOST currently looks like:

<VirtualHost *:80>
     DocumentRoot /data/sites/example_deploy
     ServerName deploy.example.co.uk
     <Directory "/data/sites/example_deploy">
        Options +SymLinksIfOwnerMatch
        AllowOverride All
        Order allow,deny
        Allow from all

        AuthUserFile /data/confs/svn/htpasswd
        AuthName "Example deployment example testing"
        AuthType Basic
        Require valid-user
    </Directory>
</VirtualHost>

We have a URL /api that takes different parameters. Examples are:

What we are trying to achieve is that /api/* would not require a valid user and the HTaccess is satisfied before the request is made. The URL may be made up of more than 2 parameters.

I've researched the subject and have worked out that I need to use LocationMatch and pass the Satisfy parameter, however I am not sure how the regular expression should be formed.

Upvotes: 3

Views: 9455

Answers (1)

HGSSO
HGSSO

Reputation: 65

I've resolved this issue. The trick is to use LocationMatch. Look at the below code:

$<LocationMatch "/api/*"> 
    order allow,deny 
    allow from all 
    Satisfy any 
</LocationMatch>

Upvotes: 0

Related Questions