Ricky ponting
Ricky ponting

Reputation: 4857

Set different htpasswd for different pages in site

I want to set different htpasswd for different pages in my website. How can i do that?

Set different htpasswd for different pages in site... Like example.com/about and example.com/portfolio should have different passwords.

Upvotes: 1

Views: 868

Answers (1)

Joe
Joe

Reputation: 4917

If each page has its own directory, then you can just create a .htaccess page for each one.

However, if they're all on the root, then you might be able to achieve this using an if directive

So for example:

<if "%{HTTP_HOST} == 'example.com/about'">
    ....
</if>

Then place your authentication code inside the if directive. You could do this for each directory you want to use a different password on.

Upvotes: 1

Related Questions