$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Other devices on same network unable to access Wordpress localhost setup|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Other devices on same network unable to access Wordpress localhost setup

matteradmin10PV0评论

I have wordpress installed in a sub-directory "www" on my laptop using XAMPP 7.3.0-0 (OS: Ubuntu 18.04 LTS Desktop).

On my laptop, I can access it through http://localhost/www/ or http://192.168.8.200/www/ (after changing WP_HOME and WP_SITEURL in wp-config.php to replace localost with IP address).

The Problem:

When I access http://192.168.8.200/www/ from other devices, it redirects me to http://localhost/www/ saying

This site cannot be reached
localhost refused to connect.

I can access other sub-directories like http://192.168.8.200/ABC/ and http://192.168.8.200/XYZ/ on same server without any issue.

Information that may help to resolve the problem

This is .htaccess file in "www" directory

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /www/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /www/index.php [L]
</IfModule>

# END WordPress

wp-config.php setting:

define( 'WP_HOME', 'http://192.168.8.200/www' );
define( 'WP_SITEURL', 'http://192.168.8.200/www' );
  1. How can I access http://192.168.8.200/www/ from other devices on same network? Any clue...
  2. How can I use my computer name instead of static IP?

Thanks

I have wordpress installed in a sub-directory "www" on my laptop using XAMPP 7.3.0-0 (OS: Ubuntu 18.04 LTS Desktop).

On my laptop, I can access it through http://localhost/www/ or http://192.168.8.200/www/ (after changing WP_HOME and WP_SITEURL in wp-config.php to replace localost with IP address).

The Problem:

When I access http://192.168.8.200/www/ from other devices, it redirects me to http://localhost/www/ saying

This site cannot be reached
localhost refused to connect.

I can access other sub-directories like http://192.168.8.200/ABC/ and http://192.168.8.200/XYZ/ on same server without any issue.

Information that may help to resolve the problem

This is .htaccess file in "www" directory

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /www/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /www/index.php [L]
</IfModule>

# END WordPress

wp-config.php setting:

define( 'WP_HOME', 'http://192.168.8.200/www' );
define( 'WP_SITEURL', 'http://192.168.8.200/www' );
  1. How can I access http://192.168.8.200/www/ from other devices on same network? Any clue...
  2. How can I use my computer name instead of static IP?

Thanks

Share Improve this question edited Feb 24, 2019 at 17:12 Qaisar Feroz asked Feb 24, 2019 at 17:03 Qaisar FerozQaisar Feroz 2,1471 gold badge9 silver badges20 bronze badges 1
  • 1 maybe a solution here will work for you stackoverflow/questions/20122583/… – user16081 Commented Feb 24, 2019 at 17:16
Add a comment  | 

1 Answer 1

Reset to default 2

Have a look at the answers here: https://stackoverflow/questions/20122583/website-in-wordpress-redirects-to-old-url-after-migration

In particular, I'd check these two: https://stackoverflow/a/23873881/1577662

be sure to clear your cache and use this script to replace ALL urls in your database.

https://github/interconnectit/Search-Replace-DB

And https://stackoverflow/a/41223768/1577662

In case you are using Polylang with a dynamic IP, add define('PLL_CACHE_HOME_URL', false); in your wp-config.php and it will solve all your problems (redirection to the former url)!

Or if you're just setting up, perhaps the easiest path forward may be to start over and use the ip address from the start on a brand new installation.

Re: How can I use my computer name instead of static IP? You would need to have name resolution set up internally, if you run local DNS servers this would work, or you could edit the local hosts files on the servers that need to access the site.

Post a comment

comment list (0)

  1. No comments so far