resolving localhost in php so can be views outside VM
Posted
by DA
on Stack Overflow
See other posts from Stack Overflow
or by DA
Published on 2010-03-31T05:34:18Z
Indexed on
2010/03/31
5:43 UTC
Read the original article
Hit count: 357
I'm running Windows 7. Within, I'm running Virtualbox and Ubuntu. Within Ubuntu, I'm running Apache and using PHP codeigniter. To reference our CSS and JS files, we use this syntax:
<?php echo site_url('css/styles.css'); ?>
When viewing the site locally (within Ubuntu VM) that resolves to:
http://localhost/styles.css
So works fine.
The catch is when I access that site from within Windows 7 (for IE testing). To access the site in Windows 7, I refer to the IP address of the VM:
http://xx.x.x.x/
That loads the site but, alas, all the site_url variables are still being rewritten as 'localhost'. Said files obviously don't exist on the localhost of my windows 7.
Is there a way around this short of just hard-coding relative links in my PHP file?
© Stack Overflow or respective owner