Thursday 22 December 2011

Use one host for multiple domain

Use one host for multiple domain
This task use php to run multiple domain on one host
Run multiple domain by parking domain
  1. Park domain
  2. Create .htaccess as following
  3. Create index.php file as following
.htaccess
RewriteEngine On
RewriteRule ^([a-z/A-Z/0-9/\-/\//+/\&/\=]*)$ /index.php?$1
    
index.php
<?php

$host = $_SERVER['HTTP_HOST'];

if ($host == 'host1.com') {
    require_once("host1.com/index.php");
} else if ($host == 'host2.com') {
    require_once("host2.com/index.php");
} else {
    header("Location: http://host3.com");
}

?>
    
PHP

  Protected by Copyscape Online Copyright Protection

No comments:

Post a Comment