Final steps for moving Wordpress site to another server - wordpress

Ive read many other threads here and also guides as this is my first time moving a Wordpress site to another server and I think Ive done everything correct so far but not sure.
So far Ive done the following:
Backed up WP files and moved them to public_html of new server and ip
Created a new Mysql db along with user and imported the old DB
Checked the imported DB in phpmyadmin and everything seems to be
there Changed wp-config file to the new db details
Also defined the site url in wp-config like so:
define( 'WP_SITEURL', 'http://www.example.com' );
Finally Ive changed my local hosts file to the following:
new.ip.here example.com
when I visit example.com it seems to redirect to www.example.com which I believe should be my site as it is still on the old/current server.
I logged in to WP anyway and did a test post but the post then appeared on the site on the old server which I guess confirms what I said above?
When I run the following ping commands I get these results though
ping example.com - new ip returned
ping www.example.com - old ip returned
Have I done everything correct so far and if so how can I test the site on the new server if its redirecting me away?
thanks

Something I do each time to be sure that I didn't forget anything is to search for my old domain name in all the base and change to the new one. Because sometimes there are hard links in posts or pages...
If you made your own theme, verify there too... Sometimes people make this mistake to put hard links...
For your host files, this will work only for YOUR computer. Check if the DNS are correct instead. then the changes ill apply to everyone.

I had created the new mysql db and user in ssh and not cpanel, even though Id checked the permissions and everything seemed in order when I logged into mysql admin in cpanel for this ip it showed no dbs and users at all for that account, strangely though the db I had imported was there in phpmyadmin.
I created a brand new db & user in mysql admin and then used both the domain plus with 'www' in my hosts file and it looks like I can see the site on my new server now and done a test post which only appears there so I think this has fixed it.

Related

How to change Wordpress site URL when migrating site to/from another server?

I have a Wordpress site that is currently running at www.example.com, hosted on a shared hosting environment. I am moving it off of this shared server, onto a cloud VM platform where I will be running a web server to host the site.
So far, I have copied the wordpress directory into /var/www/ on the new server, and configured Apache to point to /var/www/wordpress. I also created a copy of the Wordpress database from the old server, and imported it into mysql on the new server.
Before transferring the DNS for www.example.com to point to the new server, I want to make some changes to the copy of the site on the new server, using the IP address of the new server to access the new local copy, instead of the domain name www.example.com (I want to keep the original site running on the old server in the meantime, so that there is no downtime).
But after copying everything over, I cannot access the site on the new server, because the site URL is still set to www.example.com internally, so when I type in http://215.15.7.100, I just get redirected instantly to www.example.com (the existing live site on the shared server).
I have tried to follow the Wordpress instructions at Changing the Site URL, but they are incorrect or missing something. I did as suggested there and added the following to my wp-config.php:
define('WP_HOME','http://215.15.7.100');
define('WP_SITEURL','http://215.15.7.100');
... but this had no effect. It still automatically redirects me to example.com.
I also tried updating the wp_options table in the MySQL database, to change the siteurl and home settings. To do this, I ran the following queries:
update wp_options set option_value = 'http://215.15.7.100' WHERE option_name = 'home';
update wp_options set option_value = 'http://215.15.7.100' WHERE option_name = 'site_url';
... the fields were updated correctly in the database, but again, it has no effect and the site still redirects me instead of using this value.
The documentation mentions a variety of other suggested methods, with no discussion of when each is desirable to use. But at this point, I don't want to keep randomly trying things that don't work, because I don't want to mess things up.
How do I change the site URL so that it won't redirect me, and will instead just use the server IP as the base URL?
In this case OP needed to clear his own cache, so do a hard refresh or reset your browser first, then any caching plugin you may be using.
If you still are having issues with something like this, go through the following steps.
Go into phpmyadmin (make sure you are looking at the right database!), and double-check that the entries in wp_options (you might have other prefix), siteurl and home cells say what you want them to say. If no, you can edit them straight through the phpmyadmin gui, instead of using SQL commands.
Make sure your wp-config.php file on FTP/file server is hooked up to the correct database, with the correct user and password. Also check that the prefix matches the prefix of the database.
If you have access to the backend of Wordpress, refresh your permalinks, by switching forth and back to a new url structure, and back to your usual one.
As a last effort, try backing up all your plugins locally, and then deleting them from the WP install, in case you have some sort of redirect on top of the usual base-wordpress install.
The next steps are to check your theme or theme settings, or to start looking at DNS-redirects set up with your domain-host but that is a big and hairy world, and a bit outside the scope of your question.

wordpress move to localhost missing css

I'm trying to move a wordpress/buddypress web site to my local pc.
I created a virtual host with the exact same host name, copy the code and DB.
It works but every time I change the C:\Windows\System32\drivers\etc\hosts file to see the live original site, chrome miss-behave and get stuck.
So I tried to change the site domain on my local pc - I search&replace the code & db export from the site domain to my local domain (e.g. mydomain.com -> mydomainlocal.com), and I reinstall the DB.
The site is running but it seems to be missing some stuff - specifically design stuff, e.g. css is different, and logo display the site name instead of the logo.
It seems like the new domain name triggers a different configuration of the site, or a different theme.
Can someone please explain how to properly move a wordpress site localy with a local domain name?
I read some posts about this issue and it seems I was doing it right, I actually don't understand why the site looks different if I changed all reference both in the code and DB.
I'd suggest the problem lies with the fact you've performed a search and replace on the database.
WordPress serializes some data and by running a search and replace on it you'll have changed the lengths therefore breaking the serialization. Often things like theme options are stored in that way and will appear to reset when broken.
In order to update the URL you'll need a more advanced tool like: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Further information: https://codex.wordpress.org/Moving_WordPress#Changing_Your_Domain_Name_and_URLs
First You must change domain name in database wp-options table
where option_name is suteurl and home
If not help, see in wordpress admin panel theme settings, some
themes have setting and in setting those can have url setting
In browser , in source you can find errors, and in errors you can see
not correct urls
I was able to solve it answer thanks to Nathan Dawson answer, here are the actual steps I did.
I switch back to the original DB (in wp-config.php),
setup the local host of the original domain mydomain.com (NOTE that I didn't delete the settings of the new local host - mydomainlocal.com)
In mydomain.com/wp-admin/options-general.php I changed the WordPress Address (URL) and Site Address (URL) to the new domain mydomainlocal.com
click save
After saving this settings the site redirects to the new domain immediately, but since I kept the setting of the new domain it worked, and the problem is solved.
EDIT - a quick and simple solution is simply change "siteurl" and "home" in the database table "wp_options" (through phpMyAdmin or similar)

Moved multisite from domain.com to localhost - Can't get it to work

I've copied the entire wordpress folder from a server to my local machine. I have also exported and imported our MySQL database which I can access just fine.
What settings do I need to modify in order to make the wordpress sites run on my computer?
So far I have done this:
Changed define('DOMAIN_CURRENT_SITE', 'domain.com') to define('DOMAIN_CURRENT_SITE', 'localhost.com') in wp-config.php
I've added 127.0.0.1 localhost.com to my hosts file
I've changed the row siteurl to localhost.com in the database table wp_options
But I'm not sure what else to change to make it work. Whenever I try to access localhost.com I get redirected to the url listed in wp_config.php define('NOBLOGREDIRECT', 'http://www.domain.com').
I'm using MAMP and accessing MAMP works fine. It's accessing the WP sites that trouble me. I don't know how/where to set the urls to make it work.
When you move a Wordpress database, you need to change all the references in the DB from your old domain name to the new one. Doing this manually is tricky as a lot of the data is serialized.
Luckily, someone has written a program that will do a search and replace of every piece of data in the DB and you can get it here:
search-and-replace-for-wordpress-databases
e.g. You should search for all occurrences of www.your-domain.com and replace them with localhost.com It's also worth checking for server paths, e.g. /home/my_name/public_html and change it to /Applications/MAMP/htdocs

How do I create a wordpress database on XAMPP server?

I created a WordPress site on phpfog, then used git to download it locally. The way phpfog is set up I can't get to the wordpress database and access it from my localhost installation. I need to set up another database. So far, I haven't been able to get it to work. Phpmyadmin won't open.
(I've also tried a new installation of Wordpress and the same thing happens)
I think the problem is that i need a database. But, where do I put it? What directory?
Here is where I'm at right now:
in the wp-config.php file, I've changed the parameters "user" to 'root' and the password to 'mypassword'
in mylini, I've changed the password param to 'mypassword' and the port to '3306'
in config.inc.php, I've changed "user" to 'root' and 'password' to ''
When I try to connect to phpmyadmin, I get this.
Error
MySQL said:
Cannot connect: invalid settings.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
I've tried a number of ideas on various forums, but nothing gets me past this yet. Any ideas would be awesome.
Greg
First - It's hard to know how to answer as your question is rather vague. There's two very different things involved. First, setting up xampp. Then setting up wordpress. I couldn't quite figure out which you were referring to for each error, so here's a long winded explination/answer in case any thing helps:
Are you on Linux I presume? On windows it was a bit of a hassle and wamp was 20x easier. But, you might consider a preconfigured stack that includes xampp (and necessary includes) and a few other goodies, some come with wordpress installed. I haven't personally used them, but wish I had - google ought to help out there.
I'm assuming you went to (http://)localhost/phpmyadmin, right?
First you need to get there before you hook up wordpress. As for hooking up xampp, it does take some configuration, so make sure you follow the docs - it's not quite a one click install.
Once you have xampp setup, you need to create a new database in localhost/phpmyadmin for wordpress. Then go back to your file folders, which should be located in xampp/htdocs/yourwordpressinstall.
config.inc.php - is that your wordpress directory?
It needs to be wp-config.php (if it's not already there, save wp-config-sample.php as such). Open that, change server to localhost, database to the name of the database you just created. The username and password are the ones when you installed xampp. By default, I think they're User: Root, and PW: unset(blank). If you go to phpmyadmin there's a link to security and it'll show you there. localhost/phpmyadmin
Now, you should be able to type in the location of the filefolders.
localhost/wordpress/
- assuming your server is started, and the wordpress root folder is name "wordpress" and is in the xampp/htdocs/ folder.
From there you should see wordpress.
However, if you've exported your database, you'll need to change the site_url and home_url options to the new url. I'd suggest using the plugin wp db migrate (something like that) which will allow you to export the database from wordpress and auto set the values. Once the plugin is installed it's under the tools menu.
If you google migrating wordpress, you'll find plenty of tutorials and guides for moving wordpress from local to live, or as you're doing, online to local.
Sorry, I have to run, so I'm not sure if I really got to exactly what you needed, but that should get you started and give you the keywords to let google and other tutorials/docs get you the rest of the way.
I would recommend developing locally. That is, you develop stuff on your own machine with a dummy database. When you are happy with your changes, you upload them to your server, which works with your real (production) database.
To hook your local copy up with a database:
Install MySQL on your local machine
Open an interface to MySQL. On a UNIX-like system, you could type mysql on the command line
CREATE DATABASE ''databasename'';
GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"#"''hostname''" IDENTIFIED BY "''password''"; (if hostname is %, you can log in from all hosts)
FLUSH PRIVILEGES;
Update your local wp-config.php with your local credentials and database name

Moving a wordpress blog to a new host with the same domain name

I have just signed up to a new webhost with the same main domain name as my previous host. I downloaded the whole site via FTP and also exported the database in phpMyAdmin.
After changing the wp-config.php file so that the database name, username and password matched the details for my new host, I uploaded the files to the public_html folder (same directory as on the old host) and also imported the database.
Whilst I can log in, nothing has really saved. I had to set the theme again, none of the posts display etc. The information is all in the database, so I don't understand what has gone wrong.
What do you think the problem could be?
Check if you got all the files. Important files that could be missing are .htacces files: they are 'hidden' (that's what the . kinda says, and some FTP programs just ignore them
Check if you are actually working on the correct host. If the DNS isn't pointing correctly (it can differ between sessions if it isn't propagated!), you're messing with 2 servers :)
The way you described, everything should work. Also make sure you clear your cache and cookies so that the new server is recognized with your install. Also make sure that your URL settings have not changed in the general tab in the admin side.

Resources