Redirect is the process of transferring the url address to another address. For example, you can type http://www.example1.com but when you hit enter, the page that appears is a page on http://www.example2.com.
The transfer of the above can be done in various ways, eg by javascript:
<script type="text/javascript"> location.replace("http://www.example2.com"); </script>
If the script above is placed on index.html in http://www.example1.com, then the page displayed in the browser will be replaced with the contents of http://www.example2.com.
Biside the replacement of the display in the browser, the address displayed in the address bar will also be replaced with a new address. There are times when things like this are desirable. But in other cases, we may not want visitors to our website know that the page displayed is not derived from the address he was typing in the address bar.
Examples which may make sense to do is as follows. That we have multiple domains, say 3 domain. Everything is set up using WordPress CMS. Size of wordpress is approximately 10MB . Thus, you should hire a hosting that size should be larger than 10MB. So at least you should use a hosting with a capacity of 50M for example. Capacity is usually defined in certain sizes. So even if coupled with the size of the database to its contents need only 15MB, but this size may be not available.
Without the redirection, you have to hire 3 x hosting 50MB even though you only need 3 x 15MB. But with the redirection, you just need to hire a hosting with a capacity of 50MB, while the other two simply by the size of not more than 10KB. There are some providers that provide the very small capacity with a very low cost, so that we can think of for free. This service is usually given to people who already have a domain, but have not had time to build it. So he only need to show such as “Under construction”, which of course is very small in size.
With the redirect technique, we can use this facility to our other two domains.
So how to set it?
First, on the hosting with 50MB capacity, we make a subdomain. For example a domain name for hosting it is sulhansetiawan.com , then we can create two subdomains like aa.sulhansetiawan.com and bb.sulhansetiawan.com. Subdomains is just a subdomain alias for sulhansetiawan.com . Most hosting providers provide this facility. So sulhansetiawan.com can be achieved by aa.sulhansetiawan.com and bb.sulhansetiawan.com too.
For what we are creating a subdomain, but pointed to himself?
As already mentioned above, the CMS we use is WordPress. Therefore, edit the file wp-config.php in the assigment of $table_prefix. Normally this variable is filled with $table_prefix=’wp_’;
Make changes so that it becomes:
if("aa.sulhansetiawan.com"==$_SERVER['HTTP_HOST'])$table_prefix='aa_'; elseif("bb.sulhansetiawan.com"==$_SERVER['HTTP_HOST'])$table_prefix='bb_'; else $table_prefix='ss_';
Thus, although sulhansetiawan.com, aa.sulhansetiawan.com, also bb.sulhansetiawan.com, pointing to the same place, but the page displayed will be different because it uses a different table.
After setting the wp-config.php, the next step is to login to wp-admin of the three domains are, come as sulhansetiawan.com , as aa.sulhansetiawn.com, and as bb.sulhansetiawan.com
To login as sulhansetiawan.com , of course, do the settings for the domain sulhansetiawan.com itself. As for the aa.sulhansetiawan.com and bb.sulhansetiawan.com, of course, made arrangements for the two other domains. For example, if aa.sulhansetiawan.com will be used for the domain http://master-micro.com, the settings for aa.sulhansetiawan.com also be made in such a way as if we are setting http://master-micro.com. And the most important for this problem is the option-general .
Go to the option-general. In the WordPress address (URL) typically are filled in correctly, however, because we will use this wordpress to http://master-micro.com, then on the Blog address (URL) we fill it with “http://master -micro.com “. In this way, any links that are created by Wordpres will use the address http://master-micro.com.
Do it the same way for bb.sulhansetiawan.com.
The next step is to fill the hosting for the two other domains that leads each to aa.sulhansetiawan.com and bb.sulhansetiawan.com. We only need three settings.
First, we set the php.ini to allow the reading of another url by adding the line
allow_url_fopen = On
Second, we make the file .htaccess that looks like this:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Third, we make the file index.php which is like:
<?php $redirx="http://aa.sulhansetiawan.com".$_SERVER['REQUEST_URI'] ; echo file_get_contents($redirx); ?>
For other domains, just simply replace the http://aa.sulhansetiawan.com become http://bb.sulhansetiawan.com.
Well, with this index.php file in the DocumentRoot in the master-micro.com, then when there are people accessing the master-micro.com, the contents are shown taken from aa.sulhansetiawan.com. And visitors will not realize at all that they see the actual taken from somewhere else.
Good luck.