Custom 404 Error Messages - Multiple Domains - Go Daddy

Hi,

I have a Windows shared hosting account with GoDaddy.  I run multiple sites on this account and I need to be able to have custom 404 error page for each domain.  I do not run ASP.NET websites.  I just run static HTML or ASP Classic websites.  My plan has the ability to run php.  Are there any options out there?  I can setup only 1 custom 404 Error page per hosting account.
hcaadevAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad HoweDevOps ManagerCommented:
Hi,

PHP will do this for you. You essentially create a custom 404 page for you main www.domain.com and put in header referencing information to redirect.

ex: custom_404.php
========
$ref = $_SERVER['SERVER_NAME'];
if(strpos($ref, "otherdomain.com"))
{
header( 'Location: http://otherdomain.com/errorpage' ) ;
}
elseif(strpos($ref, "blog.mydomain.com"))
{
header( 'Location: http://blog.mydomain.com/errorpage' ) ;
}
else
{
header( 'Location: http://www.domain.com/error/' ) ;
}
=======

Source:
http://blog.justinkorn.com/2009/12/custom-404-page-on-windows-shared-hosting/

Cheers,
Hades666
0
hcaadevAuthor Commented:
Hi Hades666,

I believe this is the same one I found earlier but I think I go the syntax wrong.  I will test and let you know.
0
Brad HoweDevOps ManagerCommented:
K, I am testing it now in my VM. I'll let you know shortly.

Cheers,
Hades666
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Brad HoweDevOps ManagerCommented:
This code works great. I have just tested it.

Essentially, the previous posted code "(strpos($ref, "blog.mydomain.com"))" never validates so it is all the ELSE condition.

The $ref is always the income requested url. Wether that be localhost, www.dummysite1.com, www.domain.org. In the end this 404 check the refferal URL and redirects appropriately.

404.php
----------

<?php
$ref = $_SERVER['SERVER_NAME'];

if($ref == "www.dummysite1.com")
{header( 'Location: http://www.dummysite1.com/errorpage' );}

elseif($ref == "www.dummysite2.com")
{header( 'Location: http://www.dummysite2.com/errorpage' );}

else
{header( 'Location: http://domain.com/errorpage' );}

?>

-----------------

Hope it helps,
Hades666
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hcaadevAuthor Commented:
I did find this same script but I am not a php programmer so I was missing some things.  Your answers helped me complete the code needed.  Thanks for your help!!  Works fine on my side and actually I was able to program this same idea with asp with a case select.

domain = Request.ServerVariables("SERVER_NAME")

Select Case domain
      Case "www.domain1.com"
            Response.Redirect("http://www.domain1.com/errorpage")
      Case "domain1.com"
            Response.Redirect("http://www.domain1.com/errorpage")
      Case "www.domain2.com"
            Response.Redirect("http://www.domain2.com/errorpage")
      Case "domain2.com"
            Response.Redirect("http://www.domain2.com/errorpage")
      
      Case Else
            Response.Redirect("http://www.rootdomain.com/errorpage")
End Select      


Something like this.  But this works as well as the php.  I will stick with the asp since this is what I know.

0
Brad HoweDevOps ManagerCommented:
Cool. Thanks for the point and happy you got it working. This has been added to my knowledge base. - Hades666
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.