- Mac OS X (Snow Leopard was used for this article)
- XAMPP/Apache or Mac webserver of your choice
- Windows XP, Vista, or 7 install disk
- IETester (allows for testing in multiple flavors of Internet Explorer using tabs)
We've all seen this show before. The tricky part is finding your way back to XAMPP (Apache) from IE Tester while maintaining a consistent base URL. This isn't important when running a few static websites, but many frameworks have this value stored in its database. When you view your site using a different URL, links to static files (CSS, images, etc.) and other pages become broken. In a few easy steps I'm going to show you one method to resolve this issue.
Go ahead and install the above applications and OSes if you haven't already. Use the default network mode of "NAT" for VirtualBox. I'm going to assume that you can access your local sites (from your Mac) using - http://localhost/sitename/
- Step 1: Boot up your Windows install and use ipconfig (Run -> cmd -> ipconfig) to get your gateway IP. It was 10.0.0.2 for me.
- Step 2: Add the following lines to both system's (Mac and virtual Windows install) hosts files (http://en.wikipedia.org/wiki/Hosts_file). 'localhost.com' can be replaced with a URL of your choice.
# Mac: localhost.com 127.0.0.1 # Windows: localhost.com 10.0.0.2
- Step 3: Be sure that all of your web frameworks (WordPress, Magento, etc.) are aware of your new base URL 'localhost.com' (or whatever you chose in step 2).
- Step 4: Access one of your sites from each of your operating system's browser using - http://localhost.com/sitename/