• Resolved beccenstein

    (@beccenstein)


    Hello there,

    I am new at WordPress and generally everything to do with web and setting up local servers/ databases etc, so apologies if I’m unclear or don’t understand your advice fully, I’m still learning 🙂

    I have set up my localhost and mySQL through XAMPP, and got WordPress running locally. After setting up my domain and hosting (cPanel) I used Filezilla to transfer my local blog files to my host, and for a while I couldn’t get my local wordpress to show there; it only showed a default unreleated wordpress (my posts werent there, it was just the standard “Hello World”). After I checked my username and password both in cPanel and wp-config.php, I finally established a connection and could see my local blog with my own header image! ( However the credentials that finally worked were not those of the user assigned to the database in phpMyAdmin, these credentials were no where to be seen on phpMyAdmin. But they worked, apparently. Does that sound right to you? )

    The main trouble I’m having now is editing posts that will be shown at the public address location, and not just locally. Do I need two separate databases in phpMyAdmin, and import/export any new posts between them?

    The wp_admin was redirecting me to localhost/wp-admin, even when entered as http://www.example.net/wp-admin, meaning that changes I made were not being seen my public blog adress, but only at the localhost version of the blog.

    I tried changing the WordPress Address and Site Address in the dashboard to be my public URL and was logged out automatically, but then none of my username/password combinations worked – I was locked out, and the localhost location no longer worked. Having no way to get back into my admin area, I changed the WP_HOME, and WP_SITEURL both back to localhost inside the wp_config.php file, which allowed me to at least log back in again.

    I went back to settings, and changed the URLs again. At the moment the WordPress Address is my public address (http://example.net) and the Site Address is http://localhost:

    define(‘WP_HOME’,’http://localhost/’);
    define(‘WP_SITEURL’,’http://example.net’);

    I can see my new posts now! But only on the front page, the permalinks are still stuck as localhost, so trying to access individual posts remotely is denied.

    Sorry if my exact problem isn’t clear, I guess I’m not sure how to describe it. Basically, do you need to be able to access two separate wp-admin areas, one local and one public? To do this, would you then need two separate databases? Or is it usual to have only one admin area, and should that be local or public?

    Thank you in advance for any help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter beccenstein

    (@beccenstein)

    Update: I went back to the URLs and changed them both to

    define(‘WP_HOME’,’http://www.example.net’);
    define(‘WP_SITEURL’,’http://www.example.net’);

    Permalinks now look as though they are assigned to the public address, but display a 500 Internal Server Error, instead of trying to access a localhost address.

    snifflevalve

    (@snifflevalve)

    When copying a local site to a remote host you need both the files (as you have done) AND the database.

    Create a new, empty database on your hosting account and then import the exported local database into it.

    Once you have done that, make sure the siterurl and home fields in the wp-options table of the remote db are that of the live site. When you do that, you should be able to log into the dashboard of the live site where you should then install and run this plugin to update the rest of the URLs/links:

    https://wordpress.org/plugins/better-search-replace/

    After you do that, go to Settings > Permalinks and just click Save Changes; doing so rebuilds the htaccess file on the remote installation.

    Cheers!
    Lyle

    Thread Starter beccenstein

    (@beccenstein)

    Thank you for the response Lyle, I did as you suggested; imported my original database into a new, empty one, and had the urls set to the live site. Then I installed and activated that plugin.

    The permalinks no longer display that error, and the live site is looking 100% 🙂 Cheers!

    The problems I mentioned in the first of my two posts, however, are still there. The local version of my site seems to be in tatters, and I’m unsure of how to bring any new changes to the site that I make through remote wp-admin, to the local version of my site, if that makes sense?

    Is it that I need to have two separate databases, with unique WordPress logins and unique wp-config.php files, with one pointing to the live site, and the other to the localhost? At the moment using the WP dashboard will update content on either one or the other, so my local site is left lagging behind my live one.

    Thanks again, I can now at least share what I have so far on my public URL with others, as its links no longer lead to pages with errors 🙂

    Bec

    snifflevalve

    (@snifflevalve)

    I think I now “get” what you are after – synching a local site to a live site. If this is correct, then there is no “easy” way to do that and generally speaking, is not how the workflow goes.

    What some folk do, and what you have done, is create their live site locally first. Then, when it is ready to go “live”, they copy it up to their hosting account as you have now done. But that’s it. Now all subsequent changes are made on the live site.

    You can test these subsequent changes on the local version first to make sure nothing “breaks”, but once you do that, you then make the same changes to the live site.

    However, if it is just additional content you are now adding to the live site, then there are ways to do that locally, off-line, first and then publish the content to the live site. This is what I do for most of mine by using Windows Live Writer (free). For the Mac, there is Mars Edit (paid) or the ScribeFire addon for Firefox.

    Thread Starter beccenstein

    (@beccenstein)

    Thanks so much for clarifying that, and thanks for your patience 🙂

    Things are starting to add up now, I have everything connected and all the parts are talking to eachother which is a success for an absolute beginner anyway!

    Thanks again

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Localhost to Public – Do I need two separate databases?’ is closed to new replies.