Forum Moderators: phranque
what is the best way of using the same custom error docs in your subdomain as in your main site? I'm sure this question has come up before many times but I can't yet find a workable answer:
I have custom error docs (specified in my main .htaccess) which work fine in my main site
in my subdomain say chat.mysite.com/ these don't work,
now I can sort of get them to work by creating another .htaccess for the subdomain's directory and specifying a full URL to the error doc on the main site like:
[mysite.com...]
but this is a very clumsy way and brings up that URL in the browser rather than just returning the error which is not what I want.
For some reason specifying a full internal path like:
/home/myaccount/htmlfiles/myerrordocs/notfound.html does not work either in the subdomain's htaccess
Any ideas on a elegant solution (I can't Telnet in to create symlinks which I read about in a similar thread)
thanks a lot
You might want to post an example of your basic ErrorDocument directive -- it should work by default as long as your subdomains are pointed to subdirectories beneath you main domain's document_root.
Jim
# error documents
ErrorDocument 403 /myerrordocs/notallowed.html
ErrorDocument 404 /myerrordocs/notthere.html
this will just return:
"Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
when a 404 is encountered in a subdomain
thanks
What you haver there should work if your subdomains are pointed to subdirectories below the directory with your .htaccess ErrorDocument directives. How are your subdomains implimented? Where are the files located in realtion to document_root and in relation to your .htaccess file?
This is a little confusing because subdomains are URL terms, and I'm asking for file locations, but I hope it's clear enough.
Jim
Do you have RewriteRules in your existing .htaccess that redirect requests for subdomains to these subdirectories? (If so, it may be that these rules override your attempts to use a common file, and need to be changed. On the other hand, if you have mapped the subdomains to your subdirectories at the server config level, then you'll probably need to make the change there.)
Jim
The rewrite allows subdomains for my site to access these graphics as well. Theres nothing else too fancy in the .htaccess file
Unfortunately I dont have access to a server config level.
I think this a fairly common problem, and have read a couple of things of people experiencing this
thanks for your time
One thing that would indicate this is if your main .htaccess file's anti-hotlinking protection *does not* also protect the subdomains - that's easy enough to test.
The cure (if this is the problem) is to ask your host to point all subdomains to your main directory, and let *you* sort them out into subdirectories using .htaccess. There are several recent posts here on how to map subdomains to subdirectories using mod_rewrite in .htaccess [webmasterworld.com].
Jim
Theres also some deny from IPs in the .htaccess. They are still 'honored' by the subdomain from my tests. So the problem seems confined to the error docs. The situation you describe sounds like what is happening.
I cannot 'break out 'of the subdomain doing:
subdomain.mysite.com/../
I can do this though(which is acutally annoying):
mysite.com/subdomain/../
which will return to the index page of the main site
I can also do this:
mysite.com/subdomain/nonexistantfile.html
and it will return the correct error document
So it seems you are right, I will ask the host, but I don't want them to break anything else on the site, so maybe just create some new error docs in the subdomain for now!
thanks