Forum Moderators: phranque

Message Too Old, No Replies

Password protection and Bad Requests

Password protection redirects to invalid hostname

         

Doccie

1:14 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



I've been trying to password protect a certain directory on my server, but it results in a Bad Request (Invalid Hostname) error.

My directory is at [site.example.com...] and when the password is entered successfully, .htaccess redirects me to [site.example.com...] which, of course, isn't available.

Can mod rewrite interrupt the redirect by the Auth system and send it to the correct dir at [site.example.com...] And if so, how do I do this? I've tried using the mod rewrite but to no avail...

Any input would be greatly appreciated.

jdMorgan

1:36 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is the problem simply that the correct document is at "example.com/dir" while the incorrect URL is "www.example.com/dir"?

If so, look at your server config, and try turning UseCanonicalName off

There is no "redirect" on valid authentication. Only if the authentication fails does the server "redirect" -- It serves the document specified by any applicable "ErrorDocument 401" directive. Note that the path for ErrorDocuments *must* be relative to the server root, and *must not* be full URLs. This is discussed in the Apache core documentation for the ErrorDocument directive.

Jim

Doccie

2:17 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



Thank you for your very swift reply. I think UseCanonicalNames may indeed be what's causing this judging from the description. I've mailed the server admin to see if he can disable it.

I will get back to you with the results :)

Thank you for your help.