System Status

Midphase Support Center

Have a question you need answered? We're here to help.


Custom Error Pages for Parked Domains

This article contains information about setting up custom error pages for my parked domains.


Parked Domains are pointed to the same folder as your main domain, so we have to use a script to distinguish requests to various domains.
This solution would use both .htaccess and a PHP-script.

1) At the first step, create various error pages for your domains and upload them into the public_html folder:
public_html/error404-domain1.html
public_html/error404-domain2.html
public_html/error404-main.html

2) At the second step, create a file named as 404.php with the code like this:

<?php
 $domain = strtolower(getenv("HTTP_HOST"));
 if(preg_match("/^(?:www\.)?(.+)$/i",$domain,$matches)) {
  $domain = $matches[1];
 }
 switch ($domain) {
  case "domain1.com":
   include("error404-domain1.html");
   break;
  case "domain2.com":
   include("error404-domain2.html");
   break;
  default:
   include("error404-main.html");
   break;
 }
 exit;
?>

This script would detect the domain and show the appropriate error page.

3) And finally, add the directive like below into the public_html/.htaccess file:

ErrorDocument 404 /404.php
Last Updated: 10th of June, 2011     Article ID: 840

 
 

| © 2012 Hosting Services, Inc. Midphase is part of the UK2 Group.

Visa, MasterCard, American Express, Discovery, Paypal Accepted.
 

Need Help?

Our sales team is standing by, ready to help you.

Click here to chat

Si gustarias web hosting en Español, visitas nuestro sitio HostPuro.com.
Allí puedes conseguir web hosting rápido y sencillo por sólo $5usd/mes.

Stay at Midphase Continue to HostPuro