My old WordPress site http://basketball.exchange.ph was actively maintained for five years until I lost interest. After a few years of lying mostly dormant the site developed errors and essentially ‘died’ as it was inaccessible.
I wanted to reactivate it again. Fortunately I had not deleted the files and database from my shared server so making it ‘alive’ again was certainly possible. However since the site had not been updated for several years it was using a very outdated version of WordPress and was incompatible with the latest versions of MySQL and PHP.
Simply reactivating and updating it via the normal ‘one click update’ WordPress is known for is ok for most recently upgraded websites, but for those that haven’t been touched in years it may result in unwelcome surprises.
In summary, here’s what I did to avoid these surprises.
- Set up the old website to function the same way as it did before the domain lapsed.
- Set up a fresh new WordPress site with nothing in it.
- Use the Export tool on the old website to produce an xml file of old users, posts and comments.
- Import it into the new website.
Download the site by navigating to public_html and compressing that folder into .zip or .tar.gz.
You will also need a backup of the database. To do this, go to CPanel > Backup Wizard. Then click Backup, and instead of ‘Full backup’, click ‘MySQL databases’ on the right.
You will automatically download the database backup as an sql file.
Now to re activate the database. Here I use PhpMyAdmin to set a new one up called ‘old_bball’. Click the Import Tab and select the SQL file to begin.
On my Apache Virtual Host environment I run the same LAMPP set up as the webhost, with Apache, MySQL and PHP running the same latest versions.
I create the directory /srv/www/old_bball/public_html and un compress the downloaded files there.
I also need to set up /etc/apache2/sites-available/old_bball.conf using the proper values.
# domain: example.com # public: /srv/www/old_bball/public_html/ <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin firstname.lastname@example.org ServerName old_bball.local ServerAlias www.old_bball.local # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /srv/www/old_bball/public_html/ # Log file locations LogLevel warn ErrorLog /srv/www/old_bball/log/error.log CustomLog /srv/www/old_bball/log/access.log combined </VirtualHost> <Directory /srv/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
I restart apache to activate the domain. If you did anything wrong error messages will appear otherwise everything’s good.
Finally, I edit the wp-config in /srv/www/old_bball/public_html and change the db_name, db_user and db_password values to the ones used by old_bball database:
I enter http://old_bball.local via my browser and the website should appear as it did years ago, errors and all.
Now to set up a new WordPress website with nothing in it. You can follow the WordPress ‘famous one click install‘ procedure on the WordPress website and get one going asap. As I am on a Virtual Apache environment I just had to perform the same procedure as above (D.).
Here is ‘new_bball’ with nothing in it.
Log in the old_bball/wp-login.php and go to http://old_bball.local/wp-admin/export.php to download everything to a file.
Login new_bball/wp-login.php and use the Tools > Import facility. Choose “WordPress” from the list and click the “Install Now” button in the modal window for the WordPress Importer plugin.
Activate it by clicking the “Activate Plugin & Run Importer” link.
Here it is now with the users, posts and comments properly imported.
There were still a lot to do. There were some posts that I did not want to appear on the front page plus a few customizations here and there. But the important thing was that the website lived on using modern updated code and the old code had finally been discarded.