If you have developed a wordpress Site to be configured for internet and Intranet. The following script will let you access the wordpress site from two different IP address or URLs.
The home folder of wordpress contains a wp-config.php file.
Include the following lines into the wp-config.php file
NB: Once this setting is enabled and restart the server, inside the wordpress dashboard-> settings –> General –> The HOME and SITEURL will be blocked (Uneditable).
The home folder of wordpress contains a wp-config.php file.
Include the following lines into the wp-config.php file
$LAN_PREFIX = '172.16.';this will be suitable for those who needs to conserve the bandwidth inside your campus (Use Intranet) and can access outside the campus (Use Internet).
if(substr($_SERVER['REMOTE_ADDR'], 0, strlen($LAN_PREFIX)) == $LAN_PREFIX) {
define('WP_HOME','http://172.16.1.10/glug');
define('WP_SITEURL','http://172.16.1.10/glug'); // The local IP
} else {
define('WP_HOME','http://10.21.15.2/glug');
define('WP_SITEURL','http://10.21.15.2/glug'); // The public IP
}
NB: Once this setting is enabled and restart the server, inside the wordpress dashboard-> settings –> General –> The HOME and SITEURL will be blocked (Uneditable).
Comments
Post a Comment