Page 1 of 1

Looking for Easy Password Protection to Specific Pages

Posted: Fri Jan 26, 2007 9:11 pm
by zieglecu
I would like to password protect specific pages on my site, it doesn't have to be super-secure, no user accounts etc... is there a common way to go about this with CMS Made Simple?

Thanks

Re: Looking for Easy Password Protection to Specific Pages

Posted: Fri Jan 26, 2007 9:28 pm
by Pierre M.
Using pretty and hierarchical URLs you could have :
/products/boat
/products/bicyle
/zoo/koala
/zoo/shark

...and in front of this your can set up a usual .htaccess inside the webserver,
autorizing /zoo
denying /products

Hope this helps. Have fun with CMSms.

PM

Re: Looking for Easy Password Protection to Specific Pages

Posted: Sat Jan 27, 2007 3:45 pm
by KO
You could also do something using FrontEndUsers and CustomContent combination.

K

Re: Looking for Easy Password Protection to Specific Pages

Posted: Sun Jan 28, 2007 11:19 pm
by zieglecu
Pierre M. wrote: Using pretty and hierarchical URLs you could have :
/products/boat
/products/bicyle
/zoo/koala
/zoo/shark

...and in front of this your can set up a usual .htaccess inside the webserver,
autorizing /zoo
denying /products

Hope this helps. Have fun with CMSms.

PM


thank you

Re: Looking for Easy Password Protection to Specific Pages

Posted: Mon Feb 12, 2007 6:42 pm
by zieglecu
ok... I thought I knew what I was doing but I can't seem to get it right, can you give me an example of how the .htaccess file would look exactly?

Re: Looking for Easy Password Protection to Specific Pages

Posted: Tue Feb 13, 2007 3:14 pm
by osn
zieglecu wrote: ok... I thought I knew what I was doing but I can't seem to get it right, can you give me an example of how the .htaccess file would look exactly?
Here is an example of the .htaccess file:

AuthName "Enter password"
AuthType basic
AuthuserFile /home/virtual/yoursite.com/public_html/yourfolder/.passwd
<- this line must be changed!
require valid-user

Then you have to generate a password with MD5 for example at: http://www.phpbbhacks.com/md5.php (never tried this site before though)
Here is an example of a crypted md5 password:

Before: hejhopp
After: ad7a295f72e1d181d075aa343e6dca3d


If you want to use the password I generated and the username user, then you add this to a new texfile called .passwd:
user:ad7a295f72e1d181d075aa343e6dca3d


Place both the files in the directory that you want to keep password protected.

Remember that most windows text editors sometimes add invisible ascii codes that mess up the script. Try to find an editor that not is doing that if you get problems with ex. notepad. The editor I'm using is EditPad Lite but there is lots of other freeware editors you can use.

Good luck!


Dennis

Re: Looking for Easy Password Protection to Specific Pages

Posted: Thu Feb 15, 2007 1:37 am
by zieglecu
Hey osn, thank you. I just have a question about this line:

"Place both the files in the directory that you want to keep password protected."

With CMS made simple the 'directories' with clean urls don't really exist. I want anyone to get to all pages but one...

Ex:

/
/contact/
/personal/ <- Lock down this one with .htaccess stored in '/'
/something/
/sometthing/else/

Re: Looking for Easy Password Protection to Specific Pages

Posted: Thu Feb 15, 2007 9:41 pm
by Pierre M.
.htpasswd works inside the webserver in front of CMSms even if the URLs don't really "exist" but are internaly pretty-to-ugly rewritten. The protection acts before the rewriting.

So, for Apache, these auth lines may occur inside a LocationMatch or something like this :

AuthName "zieglecu private section"
AuthType basic
AuthuserFile /an/obfuscated/non/http/accessible/path/to/folder/of/.passwd
(please review Apache's manual before as I'm not sure about the syntax, just the concepts).

And go on with URL rewriting rules. I'm confident it should work. Have fun.

Pierre M.

Re: Looking for Easy Password Protection to Specific Pages

Posted: Fri Feb 16, 2007 8:03 am
by osn
Sorryu zieglecu! I'm not so familiar with pretty urls since I don't use it. At least not yet.
Pierre M. gave a good explaination that I think will work.

Re: Looking for Easy Password Protection to Specific Pages

Posted: Fri Feb 16, 2007 1:22 pm
by zieglecu
Thank you all very much, I really appreciate your time on this!