Moving to Another Server
Changing servers in a few simple steps
If you have an existing b2evolution blog (or multiple blogs) and you need to change servers here are the steps you should take to get up and running again:
- Back up your existing blog database to a file. This will save all your posts, comments and users. b2evolution v4+ includes a backup tool in the back office. If you have access to your MySQL database(s) through a program like phpMyAdmin or cPanel you can also make backups there. Otherwise, you may need to ask your host to make a backup for you. This file could be very large. One quick way to reduce the size of the database is to go the Stats tab and drop as many days as you can stand. The hitlog uses a lot of space, so click the red icon next to each day you want to delete.
- Back up your existing files. If you are goign to reinstall b2evolution from scratch, you don’t have to back up everything, but you may at least want to save any skin files that you have customized as well as any media files (pictures, videos, etc.) that you may have uploaded to your blog.
- On your new server/host create an empty database for b2evolution. This is not done through b2evolution but through your webhost or through a program like phpMyAdmin or cPanel.
- Next, import/restore your saved database (from step 1) into your new b2evo database you created. This can be done through a web panel, by asking your host for help, or by logging into the server with shell access (see below).
- At this point you can upload your saved files or install b2evolution (or have your host install it). Don’t forget to upload any skins you saved or media files you want to reuse.
- Run the installation script and give b2evolution the new base URL as well as the database information that you have just setup (step 3). This should get your blog up and running again. You don’t need to do a full reinstall of course, since you restored your previous database, but you should try to run an upgrade just to let b2evolution detect if everything is up to date (it never hurts).
In addition, if your new base URL is different from your old base URL:
- Check your
- If you notice any links pointing to a wrong location, go to the System Maintenance section and clear all b2evolution’s caches.
On some web hosts, trying to export a large database via phpMyAdmin can time out or cause other problems. If you have shell access to both servers, that can be the best way to move the data. You can export the db to a file on the server, then move it to the new server, then import it. This breaks the task into smaller parts, so you’re not trying to interact with the db and send all the data over the network in the same step.
If you have shell access, you can get a dump of your database on your old server with this command:
mysqldump -u MYSQL_USERNAME -p -h MYSQL_SERVER_ADDRESS DATABASE_NAME > b2evo_dump.sql
Replace the allcaps parts with your data. If you don’t know your MYSQL_SERVER_ADDRESS, then it’s probably localhost. This command creates the b2evo_dump.sql file. Then you can copy it to your new server using FTP or wget. Once it’s there, make sure you have a blank database on your new server, then log in to the new server and run this command:
mysql -u MYSQL_USERNAME -p -h MYSQL_SERVER_ADDRESS DATABASE_NAME < b2evo_dump.sql
Use the ‘Redirect’ option if your permalinks are broken
If, in addition to switching servers, you also switched (sub) domains you will notice the existing Permalinks are broken. If you still have a working copy of B2evolution on the old (sub)domain you can use the ‘Redirect’ option to point the old Permalink to the new post. This is also useful if you decide to move a bunch of existing posts to a separate blog.
Topanga gave an example in the forums:
My post about recipes have been around on my blog for years.
I had a category ‘food’ but that was so successful that 1.5 yeas ago, I started a cooking blog all by it own (with a different domainname). Ideally all recipes should be on that blog, and not longer on my general blog. Since some of those posts have hight Google rankings and some of those posts are mentioned on other pages, I can not simple delete those post and recreate them on the other blog.
So what did I actually do?
- I just create a new post with the exact same content (or not up to you).
- I copy/paste this new Permalink that nobody knows yet
- On the old blog, I put this new Permalink in the link URL and choose ‘redirected’.
The ‘old’ post about mayonnaise is no longer on my general blog but if you find the link to that old post, you get redirected to the new URL of ‘mayonnaise’.
I don’t loose visitors and I can clean up my blog from ‘food’ related articles.
In the Dashboard that old post is still there (yellow) but in the front, nobody sees it. It’s a bit like ‘deprecated’ but with a special function.
It’s all about ‘not loosing visitors, not putting your visitors in a ‘this posts does not exist’ mode.
Some other issues to consider
When you run the installer in step 6 above, b2evo should put everything in working order. However, if you encounter database or link errors you may need to poke around in an important configuration file. You should go through the above 6 steps before proceeding to the following options.
Most of the database configuration settings can be found in your
conf/_basic_config.php file. It identifies your database name, database user name, and database password. You will want to make sure these match the new database. The same file also has your $baseurl parameter, so when you are editing the database info you will want to correct that detail.
It’s possible that any uploaded images and smilies in your posts will still be broken because they will have absolute URLs stored in the database. Assuming you moved from ‘dumbolddomain.com’ to ’shinynewdomain.com’ you will have to make sure that all references IN THE DATABASE to ‘dumbolddomain’ get converted to ’shinynewdomain’. You could do it one post at a time, but using phpMyAdmin and searching for ‘dumbolddomain’ then replacing will probably be faster and certainly more likely to get them all.
This sub-section courtesy of the following forum post by EdB.