Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to restrict access to certain URLs with htpasswd files, rather than folders, is this possible? For example, I wish to restrict the URL:

www.example.com/pages/id/227/Restricted_Page

But allow access to other URLs such as:

www.example.com/pages/id/100/Normal_Page

Is this possible? The "pages" part of the url refers to a pages.php file, and the "id" part is the function name in that file.

The reason for wanting to do this is because of migrating existing restrict lists, in the form of htpasswd files from another site.

Many thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

From the docs:

Require Directive

Description:  Selects which authenticated users can access a resource
Syntax:       Require entity-name [entity-name] ...
Context:      directory, .htaccess
Override:     AuthConfig
Status:       Core
Module:       core

"directory" context means that you can put it in <Directory>, <Location>, <Files>, and <Proxy> sections. So, yes.

share|improve this answer
    
Thanks very much. –  me_here May 18 '10 at 14:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.