Tag Archives: SEO

WordPress Woes and .htaccess

After spending months working on our new WordPress site hosted at Linode, we were ready to flip the DNS from xxx.xxx.xxx.xxx to a realdomainname.org.

Not so fast!” said the SEO expert… “you need to have your 301s in place.” So, we went through the drill and identified the top 100 pages on the old site. These were pages that had been visited in the previous month or so, and also ones that we knew were especially popular. We then created an .htaccess file, which is a file containing instructions for any visitor who arrives at the new site via a search on an old URL from the old site.   Here’s a snippet of what it looks like to start.

# LK 5/2/2016 
Options +FollowSymLinks
RewriteEngine on
Redirect 301 /node/96821 http://www.realdomainname.org/toolbox/
Redirect 301 /node/120 http://www.realdomainname.org/designing/
Redirect 301 /node/2 http://www.realdomainname.org/
Redirect 301 /node/11522 http://www.realdomainname.org/basics/
Redirect 301 /node/13152 http://www.realdomainname.org/toolbox/
Redirect 301 /node/12931 http://www.realdomainname.org/activities/

So far so good. Except this is ass-backwards. We should have worked out the WordPress URLs before creating the .htaccess file because WordPress itself has something to say about the contents of the .htaccess file, viz:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

These entries in the WordPress file are created based on a WordPress setting under Settings->Permalinks which allow you to change what shows as a URL for access. You can choose among a number of options including having the blog post title in the URL as well as the post’s category. (another reason for assigning a post to only one category).

One you have saved the permalinks setting, WordPress will write to your .htaccess file. If this is the first time, you will see that the .htaccess file contains lines similar to those in the # BEGIN WordPress block above.  Otherwise, my guess is that WordPress rewrites the block to accommodate how you want the permalinks to appear.

Other issues:

Note the lines

<IfModule mod_rewrite.c>
RewriteEngine On

refer to an Apache web site module called mod_rewrite. This is a piece of code in the the Apache web server which accomodates the rewriting of URLS.  So, for example, maybe you have a post that is physically located at:


A default URL for a blog post might look something like:


However, after implementing your pretty permalinks it will automatically reset itself to


or even


if you choose to include a category.in the URL formula. This “virtual” URL is the one that gets indexed by the search engines, and so is worth giving some serious thought so that you get it right the first time.

Note that this whole exercise is possible only on self-hosted WordPress sites, not on sites hosted at WordPress.com. So, at this writing, the techfornoprofits.com  site is hosted at WordPress.com, and so URLs are fixed using the formula of http://site+year+month+day+blog_post_title.


So, having gotten the permalinks thing squared away, I then added the 301 redirects to the .htaccess file.  These are in the  format of:

Redirect 301 /node/96821 http://www.realdomainname.org/toolbox/

Statement = Redirect 301
Old site page name
New site address.

The /node/96821 address for the old site page is a convention from Drupal. (Drupal is another content management system. Our new WordPress site is  a conversion from a Drupal 6.7 site).

Two notes regarding the .htaccess file:

  1. The .htaccess file is normally a hidden file, so it isn’t visible within a normal directory listing. There is a setting in FileZilla which permanently “show hidden files”  If the file name is prefixed with a period, it is considered a “hidden” file.
  2. Once the .htaccess file has been created the best practice is to turn off the ability for it to be written to by changing the file permissions. Conversely, if you either don’t see any changes or get an error message when attempting to adjust the Settings-Permalinks in WordPress….the .htaccess may either be non-existent, or flagged as read-only. WordPress has to be able to write changes to the .htaccess file.

At this point the permalinks are squared away, and the 301 redirects are in place. But our woes are just beginning!

SEO, Oh No!


I’m always amazed at stupid I was yesterday*. We’re creating our brand spanking new web site for our non-profit, and my attitude to SEO (or Search Engine Optimization) was….”we’ll since we haven’t put up the web site we don’t have any statistics, and since we don’t have any statistics, there is no point in doing SEO until the site is up.”


In fact, I should have done this with my own blog site as well,  recently switched from Blogger to WordPress. So that is two strikes.

It began innocently enough… literally with a water-cooler conversation with an SEO expert, who made the following points:

  1. Run Google Analytics on your old site. Identify the top pages that are always accessed. These are the pages that you want to transfer to your new site; as intact as possible, even to using the same folder structure as the old site.
  2. Can’t run Google Analytics on the old site?  Its probably because GA was set up with a personal Google account from someone long gone from your organization. So, next time…do the organization a favor and use a generic account,  like webmaster@myorgname.org so that someone else can access Analytics if you get hit by a bus. And there should be a next time….like right now.
  3. Even if you are unable to see statistics from Google, you can run an Alexa search which searches links in and out of your site. Lots better than nothing. Or if the old site is a Blogger or WordPress site, you can get statistics from those hosts.
  4. Assuming that you can identify popular pages, you want to flag the pages on the old site with a redirect from the old page to the new page. If correctly redirected, the page rank and statistics from the old site will be transferred to the new site. Do this for enough pages and you’ll preserve the old site page rank going forward.

Notes: * from Alan Weiss,  ” I’ve been fond of stating the following truth for years: I’m constantly surprised at how stupid I was two weeks ago.”