Forum Moderators: phranque

Message Too Old, No Replies

HTTP Basic Authentication for a Specific URL

         

anjanesh

5:52 am on Feb 24, 2010 (gmt 0)

10+ Year Member



AuthType Basic
AuthUserFile /path/.htpasswd
<Limit POST PUT>
Require valid-user
</Limit>

<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

I need this to work only for a particular URL, not the entire directory.

jdMorgan

3:09 pm on Feb 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Access control is per-directory. So you will have to put the protected *file* into the protected directory, then use mod_rewrite to detect requests for the original (not-in-a-directory) *URL*, and rewrite that request transparently to the *file* in the protected directory.

Jim

anjanesh

3:35 pm on Feb 24, 2010 (gmt 0)

10+ Year Member



So you will have to put the protected *file* into the protected directory

This is based on a standard platform (magento), so cant move things around.

Actual URL would be [yourserver.com...]
and
[yourserver.com...]
if mod_rewrite is enabled.

I was hoping this would work.
<Files "https://yourserver.com/googlecheckout/api/">
AuthType Basic
AuthName "Google Checkout"
AuthUserFile /path/.htpasswd
<Limit POST PUT>
Require valid-user
</Limit>
</Files>