Use one host for multiple domain
This task use php to run multiple domain on one host
Run multiple domain by parking domain
- Park domain
- Create .htaccess as following
- Create index.php file as following
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");
}
?>
No comments:
Post a Comment