resolving localhost in php so can be views outside VM
- by DA
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?