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 (after changing WP_HOME and WP_SITEURL in wp-config.php to replace localost with IP address).

The Problem:

When I access 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 and 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]

# END WordPress

wp-config.php setting:

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



1 Answer 1


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

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

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


And https://stackoverflow.com/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.

  • 1
    Thanks @user16081 , clearing browser cache resolved the issue. Commented Feb 24, 2019 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.