.htaccess -->Authorization Required ->redirecting to bplaced

I have a small problem

user hichem
pass 1234

-When entering your username and password there is no problem…
-But the problem is when you press the Cancel been re-direction to bplaced
I want to make re-direction to the main page or a special

What is the solution?



i have made a solution for your problem:
It use the HTTP header.


if ($PHP_AUTH_USER!="hichem" OR $PHP_AUTH_PW!="1234")
	header('HTTP/1.1 401 Unauthorized');
	header('WWW-Authenticate: Basic realm="ByPassword"');
	echo "You have canceled! <a href='http://hichem.bplaced.net'>Home</a>";

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.style1 {
	font-size: 36px;
	font-weight: bold;
<div align="center" class="style1">welcome!

If you cancel the authentication, you can click on the Home-Link.

ciao, xcube

[b]He :smiley:
I do not use the php file to Protection the folder : ‚login‘ , but used the
htaccess and. htpasswd
thanks for your Help
I think that to solve this problem using a file. htaccess special
I am awaiting the rest of the members :wink2:


There is no way to redirect to a special or home site with .htaccess.
This is because of the fact that you can control the 404 error message only.

Thank you for all