First of all, I\'m pretty sure a similar question will be on Stack Overflow, but I didn\'t really find it. Probably because I am using the wrong keywords. So don\'t shoot me
Hmm, as already mentioned, htaccess will not prevent php from accessing htpassword secured folders. Consequently, Apache has to be invoked in order to use it's security features which are quite secure, at least with https IMHO, eg:
header('Location: secret/index.php');
Where the folder secret is secured with htaccess.
index.php might look like this:
And secret/index.php
The main remaining problem is now, that secret/index.php will not find any links like ./main.css etc. Therefore links have to be defined absolute not relative, but I am sure that you guys now how to do that;-)
A running example is on http://promotio.ch/secret.php/