CodeIgniter Forums
I can't check in VirtualBox because of the path. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: I can't check in VirtualBox because of the path. (/thread-25035.html)



I can't check in VirtualBox because of the path. - El Forum - 11-28-2009

[eluser]chefnelone[/eluser]
Hi,

I'm developing my site in my localhost on a Mac.
I use VirtualBox which runs Windows in my Mac to check the site in IE (Windows).

Thing is that the url to access my localhost in Mac from Windows (runnig via VirtualBox) must to be:
http://10.0.2.2/ instead of http://localhost (in mac)

Then, let say I load some style in a page of my site using a link like:

<link rel="stylesheet" href="http://localhost/ci/css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">

It just works fine in Mac, but in IE (windows on virtualbox) it doesn't. Because the link should be:

<link rel="stylesheet" href="http://10.0.2.2/ci/css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">

Problem is the different access path to the server. How can I solve this? I guess I have to change some configuration in application/config/config.php, but I don't know what.

I'd appreciate any suggestion.

Walter
Regards,


I can't check in VirtualBox because of the path. - El Forum - 11-28-2009

[eluser]jedd[/eluser]
Hi Walter,

You could have two separate config.php files - one for each, reflecting the hostname that it will return for each browser.

You could wrap some PHP around the url setting in the config file - determining what it should be called based on what it's currently called (in the incoming URL).

The easiest thing might be to just set the host name sanely in both environments, and then use that (rather than IP address). This is what I'd probably do.


I can't check in VirtualBox because of the path. - El Forum - 11-28-2009

[eluser]wiredesignz[/eluser]
Search the forums for using $_SERVER['HTTP_HOST'] in $config['base_url'] or use the local network computer name you gave to the web server.