Setup htpasswd for a specific URL

.htaccessapache-2.2drupalhtpasswd

I have a htpasswd file, works fine – in my htaccess I have:

<Limit GET POST>
require valid-user
</Limit>

Which works, login/passwd shows up fine when you reach the root of website. However I need to limit this so the login/passwd will only appear when the user reaches for example http://mywebsite.com/appear/here/* – so basically when the user reaches /appear/here/* it should show..

I've looked at Can htpasswd be used to restrict access to a URL rather than a specific folder? – but still can't seem to figure it out..

Have tried:

<Files /appear/here/*>
require valid-user
</Files>

<Directory /appear/here/*>
require valid-user
</Directory>

Best Answer

<Directory> is for a physical directory path on your server; or you can use <Location>.

One of these:

<Directory /path/to/webroot/appear/here>
    Require valid-user
</Directory>

Or:

<Location /appear/here>
    Require valid-user
</Location>