Last active
May 21, 2016 02:21
-
-
Save kjbrum/7695b1c529571a343370 to your computer and use it in GitHub Desktop.
Access projects being served on your localhost to other devices on the same network, keeping CSS, JS and images intact (add to wp-config.php file before settings). View at: your-ip-address/project-folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Access localhost on same network **/ | |
$IP = $_SERVER['HTTP_HOST']; | |
$projectDir = 'projectfolder'; | |
$localIPs = array( '127.0.0.1','::1' ); | |
if( !in_array( $_SERVER['REMOTE_ADDR'], $localIPs ) ) { | |
define( 'WP_SITEURL', "http://$IP/$projectDir" ); | |
define( 'WP_HOME', "http://$IP/$projectDir" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment