I’ve meant to pick up a domain name for the Random Bits & Bytes Blog for quite some time but I just never got around to it until now. And there certain are a lot of benefits for the blog to have its own domain name rather than having it on a sub-directory address off from my business server’s root domain.
What really got me thinking again about getting a domain name was seeing that Google’s Apps for Business allows you to buy a domain name plus privacy for about the same price that other services charge for just the domain name.
I couldn’t pass that up, plus I have wanted to investigate this service for quite a while anyway.
It turns out that it might be a bit confusing at first to some people, but following through the steps isn’t bad at all.
I first went to Google Apps for Business and clicked one of the “Get Started” buttons (don’t be turned away by the ‘Free Trial’ blurbs).
On the next screen I filled fill out my info and continued on to the next page. This screen is where you can select the option to buy a new domain (see below).
Once I did that I was presented with a place to enter the domain name that I wanted, and select the domain type and check the availability of it.
Once I verified that the domain name was available I filled out the rest of the information – username, password (good time to remind you – use a secure password, not the same one you use everywhere else. And throw in a capital or two, some special characters and some numbers and write it down in a super-secure password manager program like Msecure Lastpass, Roboform, etc), information about my organization (it doesn’t matter if you don’t have a ‘business’ or organization, just fill out this info pertaining to yourself in that case), select that I wanted to automatically renew my domain, that I wanted my domain to have privacy enabled (you usually do if you are not a business), and select which domain registrar I wanted to use. Google itself is not a domain registrar, it’s more of a reseller.
I picked Godaddy just because I am more familiar with their control panel and such, and I knew that I probably would have to be accessing Godaddy itself for setting up nameserver records.
I checked the boxes at the bottom to accept Google terms of service agreements, and the rest of the blah-blah, then continued on to enter my billing info and activating my account.
Make sure everything is correct before you activate it as all domain sales are final! Check your spelling especially.
Once everything was all set I worked my way to the Google Admin Console, playing around with it a bit.
Your’s isn’t going to look exactly like the screenshot above, but similar. If you click “More controls” at the bottom of this dashboard you can access the ‘Domains’ setting. You can also add it to your Dashboard by clicked the little plus sign in the upper right corner of the ‘Domains’ icon, and do the same for any other icon shown in “More controls” if you want to add them.
On a side note, and personal preference here – I turned off the free trial of the Google Business Apps in the options. I wasn’t interested in it for this particular application and I didn’t want Google to keep reminding me after the trial period ran out.
After clicking the ‘Domains’ icon the ‘Advanced DNS Settings’ is where I went. Here Google will tell you what your login info for the particular domain name registrar you picked is. You can click the link to be taken to the control panel for whatever domain registrar you selected.
At this point you can set your nameservers to point to where ever your blog is, or just forward the domain if you like, or park it or use Google hosting, etc. In the past I have forwarded a few domains when A) I quickly wanted to change servers or B) the site I was connecting the domain name to was a test site or C) the website was on an iffy, perhaps free, server that might occasionally be down – it’s easy and quick to change where it’s forwarding to at a moment’s notice.
In my case I just wanted to put my hosting server’s nameserver (Bluehost – excellent hosting company!) in and get the ball rolling on connecting it seamlessly to the blog. Yoo may have to search your hosting company’s technical information, Cpanel, or forums or help to find your nameserver addresses.
Next I went to Bluehost’s CPanel and under the Domain settings I used ‘Assign’ to enter my new add-on domain, verify ownership, and then assign the new domain to a sub-directory; in this case where the blog resided. Your hosting company may have vastly different settings for this but it was pretty easy at Bluehost.
Once that was done I could go to https://randombitsbytes.com/ and it would load up the blog’s homepage in my browser.
Of course this was just the beginning as clicking any blog posting or link on the blog took me back to the original sub-directory’s address of the blog.
In the old days with static websites you’d be done, but at this point the settings as well as all the database’s references in WordPress are still using all the original sub-directory addresses.
We could transparently forward the domain and mask the address of each page and posting on the blog but then all you would see is the https://randombitsbytes.com/ for every single page. We don’t want that.
So now came the fun part (and when I write ‘fun’ I write it with a generous portion of sarcasm and hyperbole – as in “No, this is not going to be much fun at all, not one bit and probably just the opposite”).
I’m going to add a little disclaimer here; this is how it worked for me, and the process that made the most sense for me from my research and general knowledge, it may work differently for you, or it may break your blog. Make a bunch of backups. Not just one, a bunch, before you do this. Know how to restore from backups too.
So the first thing I did was to make a backup using ‘BackupWordPress‘.
This was going to be a new experience for me. As a person who has worked with hundreds of websites and now is fairly well-experienced with WordPress this was the first time I needed to do anything quite like this.
But my personal philosophy is that a reasonably-intelligent person with a little knowledge, research, and common sense and logic can be pretty well-assured that they can work through most problems. This idea has served me well in my life, and I continually see others who are perfectly capable of doing something complex that they have never done before not even try because of a negative attitude.
Now I was ready, with confidence that I could overcome whatever upcoming obstacle I would have to face I installed the plugin ‘Automatic Domain Changer‘. There are some others like “Website Move” by Mert Yazicioglu, as well as other methods – like copying your blog to another sub-dir and using your domain name as the base, or changing each URL in the database using phpMyAdmin, etc. You can also find an entire description of doing it manually here from WordPress itself.
But the ‘Automatic Domain Changer plugin was damn easy to use, so I really needn’t have worried about the process – in the plugin settings all I needed to do was enter the current sub-directory where the blog resided on the server, and the new domain and decide on a few other options. After what seemed like quite some time (which actually was a fairly short time where I may have lost a little hair from sub-conscious hair-pulling) this plugin had changed all the database entries from the old sub-dir URL’s to the new domain name, it also included anything else that referenced the wrong URL’s; including widgets and theme files. I only found a few graphics files from blog postings that I had to manually change.
But now the blog wouldn’t load so I had to FTP in to the blog’s directory and edit the wp-config.php file and temporarily add the following at the end:
Once I did that I was able to log into the blog’s dashboard by entering https://randombitsbytes.com/wp-admin into my browser, but I had to reset my password to be able to actually access the WordPress Dashboard. My existing password was dead for some reason. I was a bit worried that this was a harbinger of Bad Things to Come, but it wasn’t and I had remembered reading that others may have run across this.
Once I was back in and verified that the dashboard and blog was working fine, I FTP’ed into the server again and took out the lines I had edited in the wp-config.php file. I could have left them in as I wasn’t planning on moving it again, of course.
So now everything was working perfectly with the domain, except for a few broken images, which I quickly fixed. All blog entries and pages were referenced and came back to the domain name. Success. Eureka. Whatever.
A big sigh of relief on my part was heavily heaved anyway.
Was I done at this point? No, because all of my SEO and reciprocal links and sites where people had shared and linked to my blog postings were completely dead. All of those links would come back to the root domain now with an error, since they were no longer accessible.
I didn’t want to lose all of the SEO work I had put into the blog, nor links from other sites and blogs and shares.
I already had the Redirect plugin installed on both my blog as well as my root domain site (which is also WordPress). It’s a great little plugin that lets you keep track of and manage 301 and 404 errors, and as the name says – redirect them to valid links. All done transparently and seamlessly to the user, and allowing you to give a referring server a 301 status code to tell it that the link has permanently moved.
So the first thing I did was set up some wildcard redirects on my root domain, and quite quickly. Not that I get a huge amount of traffic every moment of the day, but I didn’t want to miss anything, or anyone.
Since any errors would default back to my root domain I would catch them there using the plugin.
I set up some wildcard redirects for any website that was trying to access the blog’s pages or blog postings at their old address, configured as seen in the screenshot below.
You can see here that I used “/randombitsbytes/*” as the source, the new domain name as the target, and selected “Regex” which tells the plugin to process any wildcard characters in the URL box as wildcard characters. If you are using a wildcard make sure that Redex option is clicked, otherwise it will take the link as it is.
The /randombitsbytes/ is the sub-directory under the main root where the blog was set originally, no need to enter the whole root domain.
Now any link like http:// root-domain.com/ blogaddress / blog-post will be processed and seamlessly passed through to the visitor’s browser as the correct new address, like http:// randombitsbytes.com / blog-post.
I also did this for the tags and categories (as you can see in the screenshot). I do have some other tweaking to do (like my automated sharing does not work correctly quite yet, I think i have to reconnect everything to the social networks) also but the majority of the old URL’s will now be transparently redirected and any capable server (like Google) will be told that the link has permanently changed. Now, hopefully and fingers crossed – visitors from other sites, social networking, and search engines will be taken to the corrected links without them knowing any differently. As far as I can see from looking at the server load the plugin doesn’t seem to slow anything down as I believe that it uses the server’s own htaccess file.
Using the same plugin I can easily also check 404’s like in the screenshot below. Mousing over the entry allows me the option to add a redirect right from the 404 error screen. It helps to monitor this for a while both in the root directory as well as in the new blog domain’s WordPress installation.
I am also using the Live Traffic function of the plugin ‘Wordfence‘ to keep an eye on things, though I think it’s superfluous to use both of the plugins to monitor this, but I’m a stickler.
So now we have a new domain attached to the blog, all seamlessly integrated and with automatic redirects for the old addresses, also seamlessly and transparently done.