1

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.

1 Answers1

2

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.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84