I have xampp running on my laptop so I can run a localhost copy of my website http://whs59.net. But when I click Recent Comments, any category, or the monthly archives I end up online. I want to stay local and can’t figure out how to do so. I can’t find any suspicious references to whs59.net anywhere in c:/$LOCALHOST/xampp or a subdirectory of same. Can anyone enlighten me as to what’s going on? I suspect that something defines ‘url’ or ‘siteurl’ or somesuch as whs59.net, but that’s just a wild guess.
The value is defined in your database. This guide explains how to change it if you can’t get to the options page:
I’m assuming your localhost version has the local database set in wp-config.php
Thanks for your help. However I need a little more info to proceed.
The url for my site homepage in localhost mode shows as:
My directory structure is
The online url for the homepage shows as:
my wp-config.php file is:
// ** MySQL settings ** //
define(‘DB_NAME’, ‘wordpress’); // The name of the database
define(‘DB_USER’, ‘root’); // Your MySQL username
define(‘DB_PASSWORD’, ”); // …and password
define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!
// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-includes/languages.
// For example, install de.mo to wp-includes/languages and set WPLANG to ‘de’
// to enable German language support.
define (‘WPLANG’, ”);
/* That’s all, stop editing! Happy blogging. */
I haven’t checked yet to see the values of ‘home’ and ‘siteurl’ but would be glad to check if you can tell me beforehand what the values should be to allow local access to the comment pages, etc.
Thanks in advance for any additional help you might be able to provide.
You could rename your computer (127.0.0.1) to whs59.net in the hosts file. Also, make sure that your laptop does not change its name automatically using dhcp when you test your site locally.
Attempting to follow the idea suggested by LostInNetwork, I renamed my computer in the c:\i386\hosts file (changed localhost to whs59.net). Rebooted and checked that name in hosts file did not change.
Turned off internet connection and started site in local mode; it fired up ok except that it obviously lacked any communication with style.css.
So I assumed I needed to change my wp-config.php file from
which resulted in various errors. (Can’t find site, wrong password, 404, etc)
Am I on the right track yet? What files do I need to re-reference? Does every reference in c:\$LOCALHOST and its subdirectories need to be changed from ‘localhost’ to ‘whs59.net’? Thanks for any help you can provide.
If you’re running windows xp (probably true for other windows versions too), the hosts file is present at
Changed wp-config.php back to original setting with the following line:
Changed both hosts files to reflect new computer name whs59.net – don’t know which one is necessary (or maybe both)
Have to access local site initially as http://localhost/whs59.net
Then if I click on any links to categories, the local version prevails, although the url box shows http://whs59.net/…
Then if I click back to home, the url shows as http://whs59.net/…, which surprises me because my connection is still local, as it should be. (An initial key-in to this url would take me straight to the internet or would bomb if I had disconnected my wireless link.)
So the problem is nearly resolved. One issue remains. When I try to access the internet site from this computer (the one that hosts the local site) with http://whs59.net, the url box immediately changes to http://whs59.net/xampp/ and sends me a 404 error.
If I access it as http://www.whs59.net everything seems to work ok.
This is a trivial problem with an easy workaround (change my desktop icon link to include www.), but I would appreciate a brief explanation of what’s going on, if someone would be so kind.
On second thought it’s not trivial at all. It appears that now I cannot get full internet access to the website from the localhost computer because every time I click on a category (or any sidebar-linked page) from the internet website, it throws me back to the localhost page instead of the internet page. Maybe renaming the localhost computer whs59.net is not such a good idea after all. It kinda reverses my original problem. Now I cant access the internet website from this computer. Any suggestions out there?
c:\i386 is a place for install/recovery files. It’s not a part of the operating system file structure. Like Pravin told, the hosts file is somewhere under c:\windows.
If you edit hosts and disable dhcp, your computer will BE whs59.net. You should also note, that if you use http: in the urls then http will be used for connections and you do need a webserver.
It might be a good habit to replace “http://whs59.net” with “$WEBSERVERROOT” or something. Then your system can be ported to other domains, and you could easily make it “file://path/” for local use and testing.
Let me recap my problem and objective, and maybe someone can tell me if it is reasonably easy to accomplish my aim.
I finally have a sorta-working copy of my website on a flashdrive. I use xampplite. I can access my local site via http:/localhost/wordpress. I can then move around from the homepage to various other pages and stay local, but as soon as I click a link to a comment, I go online instead of staying local. I want to stay local. I would like to edit pages, comments, etc. without going online. I would like to be able to transfer mods to the online host via FTP. I would also like to be able to localhost-demo the whole site to others when internet access is impossible.
But as soon as I try to login or click any comment, the computer goes online (or gives me 404s if there is no internet connection). Can I fix this? That is, can I access the site locally or online at will from this computer without having to reconfigure stuff back and forth?
BTW, I did not understand the previous comment about $WEBSERVERROOT and file//path. My online url is http://whs59.net. My local access is http://localhost/wordpress. Please understand that I am not code-proficient in HTML, Java, php, whatever. I am willing to mess with MySQL and Apache and all these other MyWhatever things, but the exercise is not very comfortable. It has taken me about three weeks to get the local website copy to work at all.
- The topic ‘localhost goes online’ is closed to new replies.