Passwording Files

Sitepoint Members,
Where can I find or buy the code that will make it so a password is required to access certain webpages? A plugin won’t work because my site is straight html code.

Thanks for the help,

Chris

See the following link which is a simple tutorial on how to password protect a single/multiple files using a .htaccess file.

Chris,
That page looks pretty good.

Thanks a bunch,

Chris77

Chris,
Got it working.

Thanks,
Chris

Chris,
'Forgot to ask. Is there a way to put an expiration on a password?

Thanks,

Chris

That would be a question better suited for the guys in the server configuration forum, I’ll have this thread moved there.

Yes, block all access except for those with a valid password and remove the validation on expiration.

That said, mod_rewrite is NOT a language, it merely acts upon simple directives to SERVE FILES. If you need to build that kind of smarts into mod_rewrite, it’s called a RewriteMap and you REQUIRE access to the server (or virtual host) configuration file (because you can bring the server down with a simple error).

My recommendation is to learn a little PHP and use any of the canned login classes (or build your own) and add the PHP code via includes (sorry, it’s been so long that I’ve been dependent upon PHP that I don’t recall the HTML code for includes and will leave that for you to research - it should be trivial to find).

Regards,

DK