Assalamu’alikum wr. wb.
Bagi temen-temen semua khususnya yang hoby coding pake php mungkin dah gak asing lagi dengan kata “localhost”. Yup…localhost merupakan domain default bawaan webserver. Jika temen-temen selesai menginstal web server (misal: xampp, wamp, appserv dsb ) jika ingin mengetahui hasil instalan web server di komputer kita berhasil atau nggak, pasti yang pertama kali di ketikin di address bar browser adalah “localhost”. Nah pernahkah ada keinginan untuk mengubah dengan nama lain biar seolah-olah kita bener-bener mengakses web dengan domain yang telah kita beli di jasa penyedia hosting??
Trik ini saya dapat dari tempat kerjaku yaitu menambahkan host di local server atau di localhost kita. Jadi misal kita pengen aplikasi web yang telah kita buat di localhost ketika diakses di browser bukan lagi http://localhost/ tetapi http://domaingue.com/ maka kita perlu menambahkan host ke server lokal di komputer kita. Dengan kata lain kita ingin membuat nama alias dari localhost.
Oke, kita mulai saja.
Pertama buka Windows Explorer, kemudian akses alamat ini : C:\WINDOWS\system32\drivers\etc. Setelah dibuka maka akan menemukan beberapa file antara lain : host, lmhost, networks, protocol, dan services.
Edit file host pakai notepd atao file editor lain. Setelah dibuka akan muncul text default :
Catatan : Setau saya tips ini berlaku hanya di windows, soalnya saya belum pernah nyoba di Linux kalo misal ada yang tahu silahkan share aja…
makasih. Moga bermanfaat.
Read More »
Bagi temen-temen semua khususnya yang hoby coding pake php mungkin dah gak asing lagi dengan kata “localhost”. Yup…localhost merupakan domain default bawaan webserver. Jika temen-temen selesai menginstal web server (misal: xampp, wamp, appserv dsb ) jika ingin mengetahui hasil instalan web server di komputer kita berhasil atau nggak, pasti yang pertama kali di ketikin di address bar browser adalah “localhost”. Nah pernahkah ada keinginan untuk mengubah dengan nama lain biar seolah-olah kita bener-bener mengakses web dengan domain yang telah kita beli di jasa penyedia hosting??
Trik ini saya dapat dari tempat kerjaku yaitu menambahkan host di local server atau di localhost kita. Jadi misal kita pengen aplikasi web yang telah kita buat di localhost ketika diakses di browser bukan lagi http://localhost/ tetapi http://domaingue.com/ maka kita perlu menambahkan host ke server lokal di komputer kita. Dengan kata lain kita ingin membuat nama alias dari localhost.
Oke, kita mulai saja.
Pertama buka Windows Explorer, kemudian akses alamat ini : C:\WINDOWS\system32\drivers\etc. Setelah dibuka maka akan menemukan beberapa file antara lain : host, lmhost, networks, protocol, dan services.
Edit file host pakai notepd atao file editor lain. Setelah dibuka akan muncul text default :
# Copyright (c) 1993-1999 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
Setelah file tersebut dibuka tambahkan baris bari di bawah tulisan 127.0.0.1 localhost sesuai dengan nama domain yang dikehendaki misal domaingue.com. Jadi file tersebut setelah ditambahkan akan menjadi seperti ini :# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
# Copyright (c) 1993-1999 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 kang-ipoel.co.cc
Setelah itu simpan atau Ctrl+S. Kemudian buka browser dan ketikkan kang-ipoel.co.cc maka akan diarahkan ke localhost kita :D ..# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 kang-ipoel.co.cc
Catatan : Setau saya tips ini berlaku hanya di windows, soalnya saya belum pernah nyoba di Linux kalo misal ada yang tahu silahkan share aja…
makasih. Moga bermanfaat.

