Solved

Apache: protect whole website with pasword excluding one(2,3) URLs

Posted on 2008-10-17
3
252 Views
Last Modified: 2010-03-04
Hi experts!

I have a problem, i need to protect whole website with password excluding few URLS.

Basically i have:

<Directory /var/www/vhosts/dev.tda>
        AuthType Basic
        AuthName "Authorisation required"
        AuthUserFile /var/www/vhosts/dev.tda/conf/htpasswd
        Require user dev
</Directory>

and i need, let's say url "/api/apipoint1" to be accessible without apache prompting for password

the thing is, that i rewrite URL so "/api/apipoint1" doesn't  match any file on filesystem

Can anyone help?
0
Comment
Question by:7workers
  • 2
3 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 22744858
> the thing is, that i rewrite URL

Where? Server-context or directory context?

A possible solution could be a location container with the satisfy directive
<Location /api/apipoint1>

Satisfy any

</Location>

Open in new window

0
 

Accepted Solution

by:
7workers earned 0 total points
ID: 22774052
> caterham_www

I rewrite URLs for whole website.

So

<Location /api/apipoint1>
Satisfy any
</Location>

Doesn't work
0
 
LVL 27

Expert Comment

by:caterham_www
ID: 23137544
> Doesn't work

I can't reproduce. The following works for me (/foo/bar accessible w/o a prompt for a password).
RewriteEngine on

RewriteRule ^/foo/bar /test/test.php [L]
 

<Directory /var/www/test>

 AuthName "testerei-wq:wq"

 AuthName "testerei"

 AuthType Basic

 AuthUserFile /var/www/test/.htpasswd

 Require valid-user

</Directory>
 

<Location /foo/bar>

 Satisfy any

</Location>

Open in new window

0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now