Group Admins

WordPress Troubleshooting and Support

Public Group active 1 year, 5 months ago ago

WordPress support from our community

Tip: When using WP in a Virtual Machine environment with DHCP

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1531
    Patrick Ingle
    Participant

    Problem:


    When referencing a WP site using an IP address on a DHCP network, you will loose access if and when the IP address lease is renew via DHCP.

    Solution:


    add the following code to the end of wp-config.php (after the wp-settings.php include)

    // START OF CODE
    update_option(‘siteurl’,’http://’.$_SERVER[“SERVER_ADDR”]);
    update_option(‘home’,’http://’.$_SERVER[“SERVER_ADDR”]);
    // END OF CODE

    providing your WP installation is located in the www root.

    When you start the Virtual Machine, after logging, issue the ifconfig (for linux) or ipconfig (for windows) to obtain the current IP address. Then go to you browser and enter that IP address. You will always have access to the WP site regardless of any IP assignment. The only prerequisite is to logged into the VM session to obtain the new IP address

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.