My site is divided into the 2 parts: main one and PunBB. In the main part, there is an authorization URL which leads to '/punbb/login.php'. As you know, this page generates "redirect_url" (hidden input value), which, in my case, could be either 'mysite.com' (if i came from 'mysite.com/[nothing_here_anymore]') or 'mysite.com/punbb/login.php' (if i came from 'mysite.com/[anything_but_punbb_folder]') -- btw, why is that?
Today, I have put 'ErrorDocument 404 /?404' in my '.htaccess'. Since then, "redirect_url" is 'mysite.com/index.php?404' (no matter where I come from; though, if I come from one of the punbb-page it's still OK and can be 'mysite.com/club/viewforum.php?id=1', for example), and the final URL is 'mysite.com/index.php?404&login=1' which is totally incorrect, of course.
What should I do to prevent this error?