3

I have already read Accessing localhost (xampp) from another computer over LAN network - how to?, but I couldn't find an answer to my question.

I have setup custom domain(virtual host like how to create virtual host on XAMPP). The local IP of this PC is 192.168.1.9 and I access to it using http://sample.test.

Now I am on another PC and it local IP addresses is 192.168.1.8. How to access http://sample.test via this PC? Is it possible to configure this pc to access to the site just using http://sample.test because URL changes(Starting URL with IP Address) break the site.

Update : I am on Windows 10 PC

  • 3
    Try changing the windows host file (c:\windows\system32\drivers\etc\hosts open as administrator) on the 192.168.1.8 pc and add this line. 192.168.1.9 sample.com and save it – Nick Zulu Feb 06 '19 at 09:32
  • What kind of operating system you are using (Mac, Linux, Windows,...)? On Mac or Linux operating system you need to edit the /etc/hosts file with root privileges and add at the end what @NickZulu suggested. – sys0dm1n Feb 06 '19 at 13:08
  • @sys0dm1n Updated the post – I am the Most Stupid Person Feb 07 '19 at 05:13

2 Answers2

-1

As you are on a Windows 10 PC try editing your Windows hostfile, found at C:\Windows\System32\drivers\etc adding the line 192.168.1.9 sample.test

edward
  • 142
  • 1
  • 6
-1

Edit host file in your client computer (Windows 10), it's located on C:\Windows\System32\Drivers\etc.

Add the ip and virtual domain like this and then save the file, you might have to run your text editor as administrator.

======= My Web App =======

127.0.0.1 localhost

192.168.1.9 sample.test

Andy
  • 21
  • 8