Redireksi adalah proses memindah alamat url ke alamat yang lain. Sebagai contoh, Anda bisa mengetikkan http://www.contoh1.com tetapi saat Anda tekan enter, halaman yang muncul adalah halaman di http://www.contoh2.com.

Pengalihan seperti di atas bisa dilakukan dengan berbagai cara, misalnya dengan javascript:

<script type="text/javascript">
location.replace("http://www.contoh2.com");
</script>

Jika script di atas ditempatkan pada index.html di http://www.cotoh1.com, maka halaman yang akan ditampilkan di browser akan diganti dengan isi dari http://www.cotoh2.com.

Selain dari digantinya tampilan di browser, alamat yang ditampilkan di address bar juga akan diganti dengan alamat yang baru. Ada kalanya hal seperti ini memang diinginkan. Tetapi pada kasus lain, kita mungkin tidak ingin pengunjung website kita mengetahui bahwa halaman yang ditampilkan bukan berasal dari alamat yang dia ketikkan di address bar.

Contoh yang mungkin masuk akal untuk dilakukan adalah seperti berikut. Kita mempunya beberapa domain, katakanlah 3 domain. Semuanya diatur menggunakan CMS WordPress. Ukuran dari wordpress kurang lebih 10MB. Dengan demikian, Anda harus menyewa hosting yang ukurannya harus lebih besar dari 10MB. Jadi minimal Anda harus menggunakan hosting dengan kapasitas misalnya 50M. Kapasitas biasanya telah ditentukan dalam ukuran-ukuran tertentu. Jadi walaupun ditambah dengan ukuran database untuk isinya hanya butuh 15MB, tetapi ukuran ini bisa jadi tidak ada.

Tanpa redireksi, Anda harus menyewa 3 x hosting 50MB walau sebenarnya Anda hanya butuh 3 x 15MB. Akan tetapi dengan redireksi, Anda hanya butuh menyewa satu hosting dengan kapasitas 50MB, sedangkan dua lainnya cukup dengan ukuran tidak lebih dari 10KB. Ada beberapa provider yang menyediakan kapasitas sangat kecil dengan biaya yang sangat murah, sehingga bisa kita anggap gratis. Layanan ini biasanya diberikan untuk orang-orang yang telah memiliki domain, akan tetapi belum sempat membangunnya. Sehingga dia hanya butuh untuk menampilkan misalnya “Under construction”, yang tentu saja ukurannya memang sangat kecil.

Dengan teknik redireksi, kita bisa memanfaatkan fasilitas ini untuk dua domain kita yang lain.

Jadi bagaimana mengaturnya?

Pertama, pada hosting dengan kapasitas 50MB tersebut, kita buatkan subdomain. Misalnya nama domain untuk hosting tersebut adalah sulhansetiawan.com, maka kita bisa membuat dua buah subdomain seperti aa.sulhansetiawan.com dan bb.sulhansetiawan.com. Subdomain-subdomain ini hanyalah subdomain alias bagi sulhansetiawan.com. Kebanyakan provider hosting memberikan fasilitas ini. Jadi sulhansetiawan.com bisa dicapai dengan aa.sulhansetiawan.com maupun bb.sulhansetiawan.com juga.

Untuk apa kita membuat subdomain tetapi menunjuk dirinya sendiri?

Seperti yang telah disebutkan di atas, bahwa CMS yang kita gunakan adalah WordPress. Oleh karena itu, editlah file wp-config.php pada bagian pengisian $table_prefix. Biasanya variabel ini diisi dengan $table_prefix=’wp_’;

Lakukan perubahan sehingga menjadi:

if("aa.sulhansetiawan.com"==$_SERVER['HTTP_HOST'])$table_prefix='aa_';
elseif("bb.sulhansetiawan.com"==$_SERVER['HTTP_HOST'])$table_prefix='bb_';
else $table_prefix='ss_';

Jadi, walaupun baik sulhansetiawan.com, aa.sulhansetiawan.com, maupun bb.sulhansetiawan.com, menuju pada tempat yang sama, akan tetapi halaman yang ditampilkan akan berbeda karena menggunakan tabel yang berbeda.

Setelah pengaturan wp-config.php, langkah selanjutnya adalah login ke wp-admin dari ketiga domain tersebut, masuklah sebagai sulhansetiawan.com, sebagai aa.sulhansetiawn.com, dan sebagai bb.sulhansetiawan.com

Untuk login sebagai sulhansetiawan.com, tentu saja lakukan pengaturan untuk domain sulhansetiawan.com itu sendiri. Sedangkan untuk yang aa.sulhansetiawan.com dan bb.sulhansetiawan.com, tentu saja pengaturannya dilakukan untuk dua domain lainnya. Sebagai contoh, jika aa.sulhansetiawan.com akan digunakan untuk domain http://master-micro.com, maka pengaturan untuk aa.sulhansetiawan.com juga harus dibuat sedemikian rupa seolah-olah kita sedang mengatur http://master-micro.com. Dan hal yang paling penting untuk masalah ini adalah pada option-general.

Masuklah ke option-general. Pada bagian WordPress address (URL) biasanya telah diisi dengan benar, akan tetapi, karena kita akan menggunakan wordpress ini untuk http://master-micro.com, maka pada bagian Blog address (URL) kita isi dengan “http://master-micro.com”. Dengan cara ini, setiap link-link yang dibuat oleh Wordpres akan menggunakan alamat http://master-micro.com.

Lakukan dengan cara yang sama untuk bb.sulhansetiawan.com.

Langkah selanjutnya adalah mengisi hosting untuk dua domain lainnya agar mengarah masing-masing ke aa.sulhansetiawan.com dan bb.sulhansetiawan.com. Kita hanya butuh tiga pengaturan.

Pertama, kita atur php.ini agar mengijinkan pembacaan dari url lain yaitu dengan menambahkan baris

allow_url_fopen = On

Kedua, kita buatkan file .htaccess yang isinya seperti berikut:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Ketiga, kita buatkan file index.php yang isinya:

<?php
$redirx="http://aa.sulhansetiawan.com".$_SERVER['REQUEST_URI'] ;
echo file_get_contents($redirx);
?>

Untuk domain yang lainnya, cukup hanya mengganti bagian http://aa.sulhansetiawan.com menjadi http://bb.sulhansetiawan.com.

Nah, dengan adanya file index.php ini pada DocumentRoot di master-micro.com, maka saat ada orang mengakses master-micro.com, isi yang akan ditampilkan diambilkan dari aa.sulhansetiawan.com. Dan pengunjung sama sekali tidak akan menyadari bahwa yang mereka lihat sebenarnya diambilkan dari tempat lain.

Selamat mencoba.

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.

Time limit is exhausted. Please reload the CAPTCHA.

Notify me of followup comments via e-mail. You can also subscribe without commenting.