Map ip address to localhost [closed]

I have a website running on my mac on mamp at localhost:8888. On another mac on my wifi I can view the website, using

http://192.168.X.X:8888

(where X’s are my computer’s ip address). Except, I can view the html, but not any of the images as it is looking for them at

http://192.168.X.X:8888/images

rather than

http://localhost:8888/images

Is there a way to write http://localhost:8888 and actually be directed to http://192.168.X.X:8888 ? Thanks

Answer

edit /etc/hosts and change the line

127.0.0.1   localhost

to

192.168.X.X localhost

That said, this is a horrible idea and will likely break things, but it can be done.

Attribution
Source : Link , Question Author : Djave , Answer Author : R. S.

Leave a Comment