Pada postingan kali ini, saya mau sharing tentang cara mengubah alamat localhost.

Biasanya, ketika kita menginstall XAMPP, lalu ingin memanggil aplikasi kita, yang kita lakukan adalah mengetikan alamat localhost/nama_folder pada address bar browser.

Yang akan saya sharing pada postingan kali  ini adalah cara mengubah pemanggilan folder pada XAMPP. Jadi nantinya, kita tidak harus mengetikan alamat localhost/nama_folder, kita hanya tinggal mengetikan alamat xyz.com untuk memanggil aplikasi kita.

Langkah pertama, buka file hosts yang ada pada direktori E:\WINDOWS\system32\drivers\etc dengan notepad, (double click file hosts –> pada windows open with, click notepad)

nb : pada komputer saya, file system saya taruh di drive E:\, di kebanyakan komputer, biasanya file system ada pada drive C:\

isi dari file hosts kurang lebih seperti dibawah ini :

12345678910111213141516171819# 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

Langkah kedua, setelah anda membuka file hosts, anda harus menambahkan alamat domain yang nantinya akan anda gunakan sebagai alamat virtual host folder website anda.

untuk menambahkan alamat domain baru anda, tambahkan teks 127.0.0.1 nama_website.com lalu letakan di bawah teks 127.0.0.1 localhost

12345678910# 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 #tambahkan alamat disini : 127.0.0.1       bw2.com

setelah melakukan dua langkah diatas, sekarang saatnya kita mengedit settingan server XAMPP, lakukan langkah-langkah dibawah ini :

langkah pertama, buka file httpd-vhosts.conf yang ada pada direktori E:\xampp\apache\conf\extra.

buka file tersebut dengan menggunakan notepad.

tambahkan teks dibawah ini pada file httpd-vhosts.conf

1234567891011<VirtualHost *:80> ServerAdmin admin@bw2.com DocumentRoot /xampp/htdocs/bw2 ServerName bw2.com ServerAlias bw2.com </VirtualHost>

kurang lebih, nantinya file tersebut akan jadi seperti dibawah ini :

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455## Virtual Hosts## If you want to maintain multiple domains/hostnames on your# machine you can setup VirtualHost containers for them. Most configurations# use only name-based virtual hosts so the server doesn't need to worry about# IP addresses. This is indicated by the asterisks in the directives below.## Please see the documentation at# <URL:http://httpd.apache.org/docs/2.2/vhosts/># for further details before you try to setup virtual hosts.## You may use the command line option '-S' to verify your virtual host# configuration. ## Use name-based virtual hosting.###NameVirtualHost *:80 ## VirtualHost example:# Almost any Apache directive may go into a VirtualHost container.# The first VirtualHost section is used for all requests that do not# match a ServerName or ServerAlias in any <VirtualHost> block.###<VirtualHost *:80>##ServerAdmin postmaster@dummy-host.localhost##DocumentRoot "E:/xampp/htdocs/dummy-host.localhost"##ServerName dummy-host.localhost##ServerAlias www.dummy-host.localhost##ErrorLog "logs/dummy-host.localhost-error.log"##CustomLog "logs/dummy-host.localhost-access.log" combined##</VirtualHost> ##<VirtualHost *:80>##ServerAdmin postmaster@dummy-host2.localhost##DocumentRoot "E:/xampp/htdocs/dummy-host2.localhost"##ServerName dummy-host2.localhost##ServerAlias www.dummy-host2.localhost##ErrorLog "logs/dummy-host2.localhost-error.log"##CustomLog "logs/dummy-host2.localhost-access.log" combined##</VirtualHost> <VirtualHost *:80> ServerAdmin admin@bw2.com DocumentRoot /xampp/htdocs/bw2 ServerName bw2.com ServerAlias bw2.com </VirtualHost>

oke, proses penambahan alamat domain pada server local selesai di lakukan, langkah terakhir, anda harus mereset service APACHE pada windows XP…,

caranya, masuk ke Control Panel –> Administrative Tools –> Services –> cari “services Apache” –> Click Kanan lalu click Restart

😀

SELESAI….