Forum Moderators: phranque

Message Too Old, No Replies

Custom Error Pages for Subdomains

Creating custom error pages for subdomains

         

Synthetic

3:50 am on Apr 11, 2004 (gmt 0)

10+ Year Member



Hi,

I have site.mydomain.com password protected, and want a custom 401 error page to be displayed when users fail to login properly.

I've copied the same custom 401 error page that I have on my main directory to the sub one, but it doesn't seem display.

Can anyone help me on this?

Robino

3:51 am on Apr 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Did you make the changes to .htaccess?

Synthetic

3:55 am on Apr 11, 2004 (gmt 0)

10+ Year Member



Yes I put in something like ErrorDocument 401 /401.html and also tried it with the full url, but the custom error page still didn't appear.

jdMorgan

5:20 am on Apr 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>I've copied the same custom 401 error page that I have on my main directory to the sub one, but it doesn't seem display.

>Yes I put in something like ErrorDocument 401 /401.html and also tried it with the full url, but the custom error page still didn't appear.

Just to verify, did you use ErrorDocument 401 /401.html, or ErrorDocument 401/sub/401.html?

BTW, don't ever use a full URL in an ErrorDocument directive; If you do, Apache will do an external redirect, and the status returned to the client will be 302-Found, and not the expected 401, 404, 500, etc. This behaviour is described in the Apache ErrorDocument documentation.

Jim

Synthetic

7:46 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



I used ErrorDocument 401 /401.html in my .htaccess file located in the subdomain directory (where the 401.html page is located) and did the same with the main directory, but it still doesn't work for the subdomain.

jdMorgan

10:21 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm...

I think you may find that authentication is performed before any other function in .htaccess (for practical as well as security reasons). Therefore, you may have to split the code across multipe subdirectory levels, or do it in http.conf. Hopefully, some who's done this will have some advice based on experience...

Jim