Accessing MAMP sites from local devices, phones, tablets.January 30, 2013
So you’re developing an awesome site locally at a custom domain, like “customerxyz.dev” – but you’ve got 10 other sites with custom domains, so simply sticking in the IP of the machine running MAMP doesn’t get you what you want. So how to access MAMP sites across a network?
The best trick I learned with MAMP is using XIP.io – an awesome tool from your friend and mine, 37 Signals.
What XIP.io does is basically forward the domain with the IP and then it directs the device properly to the site you want on your machine.
- Updated 12/11/2013
I’ve found an even easier method, that makes it so if you’re changing networks (and therefore IP address) much easier as you don’t have to go back and change the IP in MAMP each time.
By using an asterisk instead, you don’t need to enter the IP and MAMP will respond properly to whatever the new or changed IP address on your network is.
For example, say your machine’s IP was 192.168.0.15 – and the domain customerx.dev – you would whip out your smart phone and enter customerx.192.168.0.15.xip.io
The only thing you have to do on MAMP is click on “Advanced” when the domain is selected and look at the bottom box “customised virtual host general settings” then put in the following;
ServerAlias customerx.dev ServerAlias customerx.*.xip.io
Obviously replacing the “customerx” & .dev part with your sites details.
What you’re effectively doing is telling Apache (the A in MAMP) to redirect any requests it receives from these addresses to the right folder on your machine.
There are a couple of problems you may have to watch out for however, namely, if you’re running a CMS that relies on exact match domains to function (like WordPress for example) you will have problems.
Additionally, if you use services like Typekit, you’ll have to add your xip.io address to the list of accepted addresses to get it running properly.
But this is a super handy tool for quick testing, especially if you’re developing responsive websites, nothing beats testing on actual devices.