Use a nifty script to automatically generate virtual hosts on my Mac. Use them for two reasons. First of all, they give me nice, clean and short URLs. When I am working on a project on my local machine, I can type in sl as the address of my site instead of localhost/sandlot. The second reason why even though I can use paths relative to root on my server local, just as I do so on my remote server. So to refer to my images directory, I can just use images/ui/images instead of trying to keep a track where I am with respect to the root of the document (e.g....)/../..(/ IU/images /).
This works perfectly in Apache on my Mac, but I have recently installed Virtualbox, so I could test stuff in Internet Explorer. Your local server from Virtualbox referencing was not clear exactly, and I found that I had to use the IP address of my Mac and the Sites folder in the folder of the House of reference. The main problem is that all root-relative paths break because the URL in Windows does not follow the same pattern. SL is very different from 10.0.1.2/~Clifton/Sites/sandlot.
After some research, I discovered a way to make Windows see my nice little virtual hosts. Here's how.
Access your hosts here file:
C:\WINDOWS\SYSTEM32\DRIVERS\etc
Edit this file with Notepad and on the bottom, remove the line that has 127.0.0.1 on it and add a new line for each virtual host that you like this:
10.0.2.2 name
The 10.0.2.2 is an IP address by default Virtualbox uses to refer to your Mac (assuming that you use the mode of networking NAT as I'm default), and the "name" is the name of your virtual host. If my complete list looks like this:
10.0.2.2 sl
10.0.2.2 clifton
10.0.2.2 cubs of
10.0.2.2 labrum
10.0.2.2 labrums
10.0.2.2 launches
Now, I can see local files instead of pushing things to a remote server so that the paths to work. He also recorded keystrokes that I can use short Windows names, just as I do on my Mac.
No comments:
Post a Comment