Migrating the WordPress Website

Moving from the AMPRNET

As a licensed Amateur Radio Operator, my AMPRNET Gateway has been on the internet for decades with domain services provided by servers at UCSD. The AMPRNET or AMateur Packet Radio NETwork has it’s own dedicated internet address space [44/8] used by amateurs worldwide for experimentation etc.

I am privileged to have my own little subnet allocation of “amprnet” addresses (assigned by authorities) that I use for experimentation, hobby use, and anything else that is FCC legal and not for profit.

I’ve had Linux servers running in the shack since 1998. As the hobby advanced we were able to link our terrestrial packet radio systems to the internet, and we used the amprnet IP addresses to set everything up.

As time went on I setup an Apache webserver, and created a simple hobby website for displaying the Slow Scan Television (SSTV) images that I received each day. (The K6HR SSTV Server continues to run to this day)

WordPress Site Outgrows AMPRNET

Last December, for fun, I installed WordPress on my amprnet server at: gw.k6hr.ampr.org/blog. Once I realized how easy WP was to use, my WP site really started to grow. As the content increased, so did the search results, and the traffic to the site. Last month the site had over 10,000 visits for the first time. It’s a lot of bandwidth, so to continue using amprnet resources was not only impractical, it was becoming an impediment.

There were a few issues that could only be resolved by changing the domain. What I had was a DNS record that pointed requests for k6hr.com to 44.16.2.58 (gw.k6hr.ampr.org) This configuration worked, but posed several issues.

Google Search Verification Fails

One major drawback was the failure of Google Search Verification. Google requires that you verify your ownership of the domain before they will index your site. They provide several verification methods, and all are simple to use. The problem is that I don’t own or control the “.ampr.org” domain so every verification tool failed. The result was I had no Google search results. ZILCH.

The WordPress SEO has a Bing search verification tool. Lucky for me Bing does not require the level of verification that Google does, so at least I had good Bing search results. (once I got my SEO figured out).

Page Load Times

The page load times reported for the k6hr.com amprnet site were very slow. The speeds were usable hobby wise, but dreadfully slow. The necessity to traverse the amprnet servers was slowing things down as traffic was increasing. i.e. ‘hop check’ results indicated the delay in the amprnet was significant. And, after all, the amprnet is not really intended for this type of traffic load.

Long Ugly URL’s

Having the k6hr.com DNS record pointing to 44.16.2.58 worked, but was somewhat of a kluge. The user would type ‘k6hr.com’ in his/her browser and would be taken to the home page. However, once there, all internal links and URL’s would be prefaced with ‘gw.k6hr.ampr.org’. So if a visitor thought he was on ‘k6hr.com/page’ he might not notice that the bookmark he saved is ‘gw.k6hr.ampr.org/page’. This could cause confusion, as it shows the long complicated URL. And, after the move, these ‘saved’ amprnet URL’s would bring visitors to the wrong place.

AMPRNET Downtime

The amprnet does not go down very often, but it has from time to time over the years. Another type of downtime is when the router at UCSD drops your route as it detects you are not there, such as when you reboot or have to temporarily disconnect your machine. Every time the connection is interrupted, UCSD drops the routing for 20 minutes or so before checking again and reestablishing the route. They have valid reasons for this, and it is understood within the amprnet community.

I needed to move an ethernet cable to a different port and disconnected it for only seconds before my amprnet routing was interrupted. Of course, after the requisite 20 minutes, the routing returned.

Migrating the WordPress Website

It was time to straighten up and fly right. As part of the 2018 upgrades I built a new Intel i5 PC and installed Ubuntu 16.04.5 LTS on it. The previous server ran on an old Pentium D with 1GB RAM so this would be a big improvement with 4GB RAM and a 500GB SSD.

I found this article with step by step instructions and read through it. It seemed to be a fairly straightforward process. I had nothing to lose on this new machine, so there was no pressure of making (or repeating) a mistake.

Once I had SAMBA working on the new PC, copying over the original WP files was easy. In the article it was suggested that using the “Search Replace DB” script found on github would make changing all the URL references in the database much easier, but after fiddling with it for a while I could not get it to work. I decided to try using the replace command in Midnight Commander instead.

First I made a backup copy of the current WP database

1
2
>mysqldump -u root -p mydatabase > mydatabase.sql
Enter password: **********

Next, I opened the mydatabase.sql file in Midnight Commander and did a replace gw.k6hr.ampr.org with k6hr.com and crossed my fingers. It went on processing much longer than I expected, but in the end had made over 7,000 replacements.

As explained in the article, the .htaccess file in the WP root directory must be edited to reflect the new domain, and the wp-config.php file also requires an edit. In my case I used the same db name, and user name, so all I had to edit was the password, as I had not used the same PW again for this install.

Next, I imported the modified mydatabase.sql file into the new database I just created using the same dbname.

1
2
>mysql -u root -p mydatabase < mydatabase.sql
Enter password: **********

To test the WP installation I opened the site on the localhost and to my delight everything appeared to be working!

I did encounter one problem, but it was easily resolved after following the suggestion in this Google search result.

Updating the DNS records

I logged in to my web hosting service and changed my DNS record to point to the IP address of my Frontier FIOS router. Next I logged into my Frontier router and deleted the ‘http’ port forwarding rule to the amprnet server and replaced it with a forwarding rule to the new machine.

Sounds good! I should be all set!

It works, but…

The new server is up and running and I am no longer pointing my DNS or router forwarding rules to the old machine. The new site working great! I’m enjoying the major improvement in page load speed!

But as I test further I find that the old amprnet machine is still serving webpages! How can this be possible?

After some head scratching I realized the amprnet machine is in my routers DMZ. (that ‘http’ port forwarding rule meant nothing!) This means folks could connect to the amprnet machine and land on an out of date version of the site.

You’re thinking why not just stop the Apache server on the old machine?

Webalizer Stats

Before I turn off the old Apache server I need to migrate Webalizer and all of its stats. I haven’t quite figured it out yet. The traffic is still registering as the old site and nothing’s updating on the new machine yet.

I’m sure this is because the traffic is visiting the old URL directly.

I decided to try my hand at ‘redirection’. I think if I redirect the traffic to the new machine then I will keep the traffic flowing from those direct connections to the old URL. Now that I’ve hit 10,000 visits per month I don’t want to screw it up.

Redirection

The redirection was simple following the instructions in this article. I just added that simple bit of code to the top of the index.php file in the old WP root directory, and Voila! It works like a charm! Now all traffic ends up on the new website. Now I’m in no hurry to turn off anything on the old server.

Google Search Verification Success!

Now that I have eliminated the use of the amprnet, and pointed my DNS directly to my home router IP, the verification steps were all completed in a matter of seconds. I have finally, successfully, verified my domain ownership (via multiple verification methods) on Google!

I was immediately able to find search results. Prior to these changes there were absolutely no search results on Google whatsoever!

Now that Google is indexing my WP site it won’t be long before detailed search results begin to appear, and traffic really starts to pick up!

This WP site will be one year old on 12/10/18 and ready for action with all these great improvements and breakthroughs.

Back To The Front

Author: K6HR

Licensed since 1994. Active on HF / VHF / UHF / Satellite.

Leave a Reply