During production of a website, there probably will come a time when you would want to test your site on a smartphone and a tablet. However, having to upload your site to the hosted server first just to check this is not ideal. You don’t have to do this and you can actually access your site quite easily from your local development site in the MAMP environment in just a few simple steps.
These instructions only work on a mac, with MAMP installed and a wifi internet connection.
1. First, if you haven’t already, you need to fire up your MAMP application.
2. Then you should open you System Preferences and go to the Network settings page. There you should be able to see the Wi-fi IP address.
3. Then you’ll want to add these two lines of php into your wp-config file. You can access your site without doing this step, but the site will load without styles, as the the http://localhost path will not be recognized on you phone/tablet.
define('WP_SITEURL','http://192.168.1.6/');
define('WP_HOME','http://192.168.1.6/');
4. Open up your phone/tablet browser and insert the IP address and you should be able to check your site. Depending on your MAMP setup, you might have to add the Apache port after the IP address like this. 192.168.1.6:8888.
Happy coding! 🙂
PS. Remember when your done testing, remove those to lines of code from your wp-config.php file.
Skriv et svar