Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Http authentication not working in linux hosted website
- <?php
- // User name and password for authentication
- $username='username';
- $password='password';
- if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
- ($_SERVER['PHP_AUTH_USER'] !=$username) || ($_SERVER['PHP_AUTH_PW'] !=$password))
- {
- // The user name/password are incorrect so send the authentication headers
- header('HTTP/1.1 401 Unauthorized');
- header('WWW-Authenticate: Basic realm="My Web Page:The Freedom Square Of Internet"');
- exit('<h2>My Web page</h2>Sorry, you must enter a valid user name and password to access this page.');
- }
- ?>
- RewriteCond %{HTTP:Authorization} ^(.+)
- RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]
Add Comment
Please, Sign In to add comment