Can htpasswd be used to restrict access to a URL rather than a specific folder?

Posted by me_here on Server Fault See other posts from Server Fault or by me_here
Published on 2010-05-18T10:49:38Z Indexed on 2010/05/18 10:51 UTC
Read the original article Hit count: 153

Filed under:
|
|

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.

© Server Fault or respective owner

Related posts about htpasswd

Related posts about .htaccess