PDA

View Full Version : Access localhost from virtual pc


spetsacdc
06-25-2009, 02:40 AM
Hey, I am trying to test my development server on a virtual pc (so I can test all versions of IE).

I have my host pc at the static ip:

192.168.0.1

the virtual pc is

192.168.0.2

I changed my apache config to allow from 192.168.0.2

When I go to my virtual machine and type 192.168.0.1 in IE, it loads my webpage from my host.

The problem is, that I wrote all the links and directories as http://localhost/images or http://localhost/css.

So, my virtual pc can't load images or css sheets. Anyone know the easiest way to fix this?

I dunno if I change my apache config or something on the virtual pc's network settings.


Thanks

tomws
06-25-2009, 09:39 PM
That's a good reason for using site-root relative paths instead. Change them all to "/images/somefile.jpg" or "/css/myfile.css" or "/thisfile.html". You'll have to change all of them anyway if you plan on deploying the site to any other server.

spetsacdc
06-25-2009, 11:43 PM
Ah ok, so "/images" is relative to the site root, but "images/mypic.jpg" is relative to the current directory right?

I was leaving off the first "/" and making stuff relative to their directory.

This messed up when I was using mod rewrite to rewrite...

"http://localhost/comments/3/53" to http://localhost/comments/index.php?n=3&d=53

If the number of parameters changed, it would read it from different "relative roots"...so relative to current directory messed up between:

"http://localhost/comments/3/53"

and something with more parameters like:

"http://localhost/comments/3/53/343/12"

Thanks!