A client’s website that had not previously been competitive with the most competitive SEO keyword for their particular industry began being so, confirmed by noting that a related, but more competitive keyword was appearing in Google Webmaster keyword searches. Wanting to proceed cautiously, we swapped out our previous keyword for the more enticing competitive keyword on the most highly ranked page of the site. The page maintained its SEO rank after the switch, confirming that we were, indeed, ready to switch to the more competitive keyword.

The issue now was how to do a full keyword replacement on the database inclusive of all links, URLs and HTML. The site was a very large e-commerce site with many blog posts and many products.

For years, I’ve been using a very useful tool for domain name switches in WordPress. As you may or may not know, simply switching the domain in WP-ADMIN does not change file URLs. Image links will break as soon as the old domain is switched off. And we cannot do a full database search and replace utilizing SQL, because so much of WordPress data is serialized.  The SQL search and replace would break the serialization due to string length changes.

However, the following product solves this problem: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/, adjusting for changes in string length in the serialized data.

Now a full database keyword replacement can take place. For file names, however, we need to run a Linux command.

The following command renames parts of a filename by doing a search and replace recursively through directories:

find /your/target/path/ -type f -exec rename ‘s/oldkeyword/newkeyword/’ ‘{}’ \;

After running this command on one gigabyte’s worth of files, our Linux cloud server took about ten minutes to traverse the directory structure of our WordPress uploads directory. But once we reloaded the browser, the switch was relatively seamless. We cleaned up a few areas where the new keyword was not applicable before we submitted the whole site to Google Webmasters for immediate crawl and indexing.

If you are interested in reviewing your keyword strategy or want to know if the time is right to begin exploring your options, you can review my services here.