Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Protect a section with HTTP authentication?
A client is selling a web service using PayPal’s subscription password management script, which gives subscribers access to a directory through basic HTTP authentication. The PayPal perl script automatically updates an .htpasswd file, removing access when a subscriber stops paying.
All is working well, but we would also like to allow access to articles in a Textpattern section reserved for subscribers. So, we really need to have Textpattern apply HTTP authentication to one site section, using a given .htaccess file. Any ideas how I should go about this?
Offline
#2 2006-07-31 16:26:03
- alexandra
- Member

- From: Cologne, Germany
- Registered: 2004-04-02
- Posts: 1,370
Re: Protect a section with HTTP authentication?
Did you already do a forum search ?
There is a plugin called ign_passwordprotect… that might help?
Offline
Re: Protect a section with HTTP authentication?
Yes, I spent a long time searching the forum, although it’s perfectly possible that I have missed the blindingly obvious somewhere.
As far as I can see, ign_passwordprotect uses the textpattern database to restrict access. I want to use an already existing Apache password file (.htpasswd).
Offline
Re: Protect a section with HTTP authentication?
Honestly, I don’t know how that can be done since a section is not really a physical directory.
But I’d like to hear if there is a solution because I too was contemplating the same thing.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
#5 2006-07-31 17:05:17
- Esteban_Panzera
- New Member
- Registered: 2006-07-31
- Posts: 4
Re: Protect a section with HTTP authentication?
I am looking the same thing, and I already spent some time searching the forums, didn’t find anything though
Offline
Re: Protect a section with HTTP authentication?
Suppose your website is at http://example.com and TXP is installed in the root directory and you want to protect the section called ‘protected’ (http://example.com/protected), you could try this:
- Physically create that directory ‘protected’
- Within that directory ‘protected’, create the following .htaccess file:
<notextile><pre><code><IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*) ../index.php
</IfModule>
AuthType Basic
AuthUserFile /path/on/server/to/.htpasswd
AuthName “Only for registered users”
require valid-user</code></pre></notextile>
Offline
Re: Protect a section with HTTP authentication?
Ruud, that works for me. Nice and simple too (once you know how, of course). Many thanks.
Offline
Re: Protect a section with HTTP authentication?
ruud,
care to place this example in the “examples” forum. Its a good one :)
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: Protect a section with HTTP authentication?
Thanks ruud, the creating of the directory was the key to it.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline