View Full Version : probs w .htaccess errordocument

11-20-2003, 11:19 PM
I've created a .htaccess like this (on an Apache/1.3.27 Server):

# -FrontPage-

DirectoryIndex index.asp default.asp
ErrorDocument 403 /error/403.asp
ErrorDocument 404 /error/404.asp

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
order deny,allow
deny from all

It works fine with the errordocs, even from subdirs. However, I found a problem that I cannot solve, even after looking through this forum and gigabytes of reference manuals...
When I try to access a directory like 'www.mydomain.com/mydir' it works fine but when I use 'mydir.mydomain.com' I get a server error Not Found or Forbidden depending if mydir exists or not and then 'Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.'

After testing a lot of configurations I have narrowed the problem down to this (I think): If I use mydir.mydomain.com, it will look for the errorpage at mydir/error/404.asp.

One solution would be to use absolute paths, ie. http://www.mydomain.com/error/404.asp but I don't like that option since it would replace the address in the browser's address bar.

Any suggestions how to fix this or maybe how to make a check to see if there is a directory name at the beginning of the entered URL?

Thanks in advance

11-21-2003, 02:48 PM
The 'mydir' part of the 'mydir.mydomain.com' which translates to 'www.mydomain.com/mydir', is that what is meant by a virtual directory? Or is it called something else?

11-21-2003, 04:01 PM
the server sees the blah.thepage.com and thepage.com as two totally different sites. You are going to have to hard code them in to the best of my knowledge.

11-21-2003, 05:35 PM
Yeah, that was what I was afraid of. Using absolute paths works fine, as I mentioned, but I was hoping somehow to be able to make it look for the error pages in the root without the dir name...