You are invited to Log in or Register a free Frihost Account!

secure subdomain .htaccess problem.

Ok this is the first problem i've encounterd using .htaccess not to sure what i'm doing wrong. Here's the problem:-

I have a main domain '' and have created a subdomain '' in the subdomains root i have created a .htaccess file to password protect the entire subdomain this works perefectly Smile

I am now trying to set up custom error pages for the subdomain, i have already added them to my main domain and they work fine, but i cant get them to work on my subdomain Sad i have added the following to .htaccess
(the path and filenames are all correct)

ErrorDocument 401 /errors/401.shtml

If for example i go to login to my protected subdomain and deliberately enter the wrong crudentials i should be taken to my custom error page '401.shtml'
instead i get the standard Apache 401 page. It seems that because i failed athentication (deliberately to test the 401 page) i therefore do not have the rights to view the custom '401.shtml' page on my server Sad
So i thought i would try to redirect the error pages from my protected subdomain to my error pages on my unprotected main domain. example:-

ErrorDocument 401 /../errors/401.shtml

hoping that /../ would take me back up a level into my main domains root folder, but it appears that the subdomain folder is treated as root for the subdomain and therefore ../ is not valid as there is no subdirectory to root! Aaaaagh!!!
So i then tried to use Apache's 'redirect' command in the .htaccess to redirect the 'errors' folder to the unprotected 'errors' folder on my main domain example:-

Redirect errors/
ErrorDocument 401 errors/401.shtml

this didn't work either giving me the same problem, i have also tried the following :-

ErrorDocument 401

but in my server log i get told :- [notice] cannot use a full URL in a 401 ErrorDocument directive --- ignoring

If i cant use a full URL to my error page and i can't use internal '../' then what can i use?

Now i'm stuck Sad
I want to keep my subdomain password protected from root. but i also want my subdomains custom error pages to work. I'm not an expert in this field and i'm sure it must be possible to do this. I've searched various forums for an answer and found a few dirfferent people with the same problem.
Anyone's help would be greatly appriciated.

TIA TurboSquid
Try with "./errors/401.shtml" or "/home/turbosqu/<subdomain directories>/errors/401.shtml".
Hi bondings, i have just tried :-

ErrorDocument 401 /home/turbosqu/domains/

which is the full internal path to my error page but it dosent seem to work either Sad
I just tried to look in the error log of my main domain to see what error was given, but for some reason 'Direct Admin' is telling me "Error document not found"? checking in the logs folder via FTP sure enough there are no logs for '' any chance you could have a look and see why there are no error logs generated for this domain? as my subdomains error logs are working fine.



----- FriHost The Best Free Hosting Out There! -----
I changed it to this for you and it seems to be working fine now Smile
ErrorDocument 401 ../errors/401.shtml
ErrorDocument 403 ../errors/403.shtml
ErrorDocument 404 ../errors/404.shtml
ErrorDocument 500 ../errors/500.shtml

By going / and then ../ I think you were sort of cancelling them both out (though not 100% sure on that but it seems the most logical explanation).
Related topics
.htaccess problem
subdomain creation problem
htaccess problem again
.htaccess Problem With Register_Globals
40Frih for Help with .htaccess problem
.htaccess problem
htaccess Problem
Wordpress htaccess problem
CPanel subdomain creation problem
Solve this HTML mystery for 20Frih$
Image linking within my site seems to not be working
.htaccess Problem - PLEASE help - Reward Offered
.htaccess problem in wordpress
Subdomain management problem.
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

© 2005-2011 Frihost, forums powered by phpBB.