Jump to content


This topic is now archived and is closed to further replies.


using PHP to bypass .htaccess ?

Recommended Posts


I have chosen to protect my website using .htaccess since I use a LeftFrame for navigation, and a MainFrame to load PDF Documents.

Now, I have three different sites, and, I need a 'User Manager' interface which allows the admin to control user access to any combination of these sites. I have actually used a global PHP login, which provides respective access to a PHP file with this line only:

header("Location: [a href=\"http://username:password@website_X");\" target=\"_blank\"]http://username:password@website_X");[/a]
* That would forward the user and somewhat secretly bypass the browser's request for a new password. Since IE now prohibits passwords within URLs by default, this can no longer be achieved...

The question is, how can I protect those PDF documents and authenticate via PHP, using a MySQL database to keep track of user details?

Does $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] have anything to do with .htaccess? Could this be an alternative?

Thank you :)


Share this post

Link to post
Share on other sites
To answer my own question (after more research).

This can be achieved with these lines:

$pdf = 'dummy.pdf';
header('Content-type: application/pdf');
//header('Content-Disposition: attachment; filename="'.$pdf.'"');

...just in case anyone else is searching on this topic :)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.