#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    111
    Rep Power
    4

    Set domain url point to local machine or web server?


    Hi. I install apache on my ubuntu. I wonder how do I point any traffic from my machine (brower) going to a domain (example: mydomain.com) and actually point to my localhost?

    Assume I did the vhost config on my apache or other config. I know in windows I just set a line like mydomain.com 127.0.0.1 on the hosts file in the window system directory.

    But how do u do that in linux? Is there a similar host file in my linux machine?

    Thanks.
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    /etc/hosts
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    111
    Rep Power
    4
    Originally Posted by E-Oreo
    /etc/hosts
    Thanks. Do I also need to flush host or something? In window I think I need to do ipconfig flushdns or something.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Location
    Canada
    Posts
    13
    Rep Power
    0
    No, there is no need to flush anything. Changes to the hosts file on Linux takes effect as soon as the file is saved.

    You can also do something like this in the hosts file(also works in Windows):

    Code:
    127.0.0.1 mydomain.com example.com helloworld.com
    You can separate multiple domains with a space.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    111
    Rep Power
    4
    Originally Posted by kveroneau
    No, there is no need to flush anything. Changes to the hosts file on Linux takes effect as soon as the file is saved.

    You can also do something like this in the hosts file(also works in Windows):

    Code:
    127.0.0.1 mydomain.com example.com helloworld.com
    You can separate multiple domains with a space.
    Thank you. I didn't know I can do that.

IMN logo majestic logo threadwatch logo seochat tools logo