How to:redirect localhost to my external IP address in Apache

I’m using XAMPP to learn wordpress these days.I’ve established a simple site.After opening 80 port in my router,I can visit my site like this:

ExternalIP/wordpress

Read More

The problem is:I can ONLY open my index.php.I notice that the links in index.php all begin with “localhost/”.I know I have to do something to modify it to my actual IP address,but I cannot figure out how to do it.What am I supposed to do?

Best regards.

Related posts

Leave a Reply

1 comment

  1. Sometimes it is easier to temporarily add your siteurl and home url to the config file, rather than updating the DB. That way when you go live you just remove the lines from your config.

    Add the following lines to your wp-config.php file after line 64 where it says define('WPLANG', '');

    define('WP_SITEURL', 'http://YOUR_LOCAL_IP');
    define('WP_HOME', 'http://YOUR_LOCAL_IP');

    If you have WP in a sub-directory add that directory to the WP_SITEURL var only, for example:

    define('WP_SITEURL', 'http://YOUR_LOCAL_IP/wordpress');
    define('WP_HOME', 'http://YOUR_LOCAL_IP');

    Replace YOUR_LOCAL_IP with your actual host machine IP, such as http://192.168.0.1.

    If you are not developing locally, and only accessing remotely, you can use YOUR_EXTERNAL_IP in place of the local one.

    Finally, navigate to WP Admin -> Settings -> Permalinks and click Save. This will reset WP to use your new value for links.

    If you have any hardcoded links or images in Posts or Pages, you’ll have to manually update the URLs for those.