I can't check in VirtualBox because of the path.

#1
[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,

#2
[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.

#3
[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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.