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
1 | RewriteEngine On |
2 | RewriteRule ^([a-z/A-Z/0-9/\-/\//+/\&/\=]*)$ /index.php?$1 |
RewriteEngine On RewriteRule ^([a-z/A-Z/0-9/\-/\//+/\&/\=]*)$ /index.php?$1
1 | <?php |
2 | |
3 | $host = $_SERVER['HTTP_HOST']; |
4 | |
5 | if ($host == 'host1.com') { |
6 | require_once("host1.com/index.php"); |
7 | } else if ($host == 'host2.com') { |
8 | require_once("host2.com/index.php"); |
9 | } else { |
10 | header("Location: http://host3.com"); |
11 | } |
12 | |
13 | ?> |
<?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