In April, I decided to change the website name and address for this blog you are reading now. To make a long story short, I wanted the name to reflect what I primarily write about (astrophotography and technology) versus being all about my name. I may explain in more detail later, but “Computer Looking Up” offers a variety of future options for the blog that are not tied specifically to me.
This article, however, is about a lesson learned when migrating your website to a new URL. I had never done this before, or at least not in a way for a website owned exclusively by me (versus wordpress.com). I thought I had done it right, but I realized days later than something was very wrong! I noticed the problem when I checked for how Google included my website in search results.
WordPress uses Apache for its web server by default, so my task was to redirect traffic from my old website to the new one by making the needed change to Apache. Further, if you specify the redirect as a “301,” that cues Google and other search engines the move is permanent. So on my old WordPress Apache web server, I created a 301 redirect to “https://computerlookup.com” for all traffic. So far so good, right?
Several days later, only as I noticed traffic to both my old and new websites dropped significantly, did I decide to test Google’s search engine on how it was finding either my old or new website. I took one of my most popular articles and typed in search terms I knew google.com would find. Sure enough, I saw my old website show up, which seemed fine to me, but when I clicked on Google’s link, to my horror, the address was invalid!
After a brief panic, I discovered what the problem was. As an example, suppose I had an article on my old website:
I would have expected the 301 redirect to bring visitors to the new home for the article at:
But instead, the Apache web server was redirecting the article to:
See the issue? There is no forward slash between “.com” and “article_name” so the URL was of course invalid.
I went back to the Apache web server on my old blog. Specifically, the file that must be edited to perform a 301 redirect is:
Within .htaccess, the redirect is simply this line near the end of the file:
Redirect 301 / https://computerlookingup.com
As you can see, the literal interpretation of this is to redirect everything to “computerlookingup.com” and not to “computerlookingup.com/” for all articles. It is a subtle but critical format for the redirect to work properly. So I changed the line to:
Redirect 301 / https://computerlookingup.com/
…restarted Apache, and all redirects from Google started working as expected.
Google does not have a lot of patience for invalid addresses. Google apparently assumes very quickly that invalid URL addresses are permanently gone and removes them from its SEO index. This is scary especially if you are running a business and your SEO is critical to revenue. Even in my small case, it does seem that Google temporarily disavowed my websites when the addresses were invalid redirects for a few days. See the graph at the top of this article. I made the website change on April 24th and caught the problem on either April 26th or 27th, I cannot remember. But as you can see, once the 301 was fixed, web traffic started to increase again (note the graph is slightly not to scale and the new results were a bit lower than shown).
In the end, the 301 redirect did its job, and within about a week searches were redirecting to my new website. So despite a few days’ loss of web traffic, I apparently got a pardon from Google SEO and it noticed and leveraged the 301 permanent redirect.
The bottom line is, when you move a website to a new URL, be sure to test it in Google searches!