Blog setup: how WordPress, SEO, and .htaccess can all be friends.
There are a lot of questions about making Wordpress play nice with other functionality on your site, so here’s the solution that works for me.
One of the first things to do after installing Wordpress is to configure it for “pretty permalinks”, in the options tab. That gives you links like this rather than some “index.php?a=144″ gibberish. Unfortunately, it modifies your .htaccess file to do this, and in a way that isn’t terribly friendly with other functionality you might want.
Fortunately, there’s an easy fix: enable Wordpress’s “verbose” rewrite rules by setting “use_verbose_rules” to true in your wp-includes/classes.php file.
Now that you’re good and friendly with your .htaccess file, let’s do a bit of search engine optimization (SEO) to your site. If your site displays the same at “mydomainname.com”, “www.mydomainname.com”, and “www.mydomainname.com/index.html”, you can easily confuse search engines. Unless you explicitly tell Google otherwise, for example, it will treat “mydomainname.com” and “www.mydomainname.com” as two different sites. If people start linking to both, it can hurt your PageRank.
There’s an easy solution to this, too: a 301 redirect. Several sites explain the ins and outs of 301 redirects and .htaccess syntax, so I’m just going to give you the code that works for me. Put this near the end of your .htaccess file, but before the “#BEGIN WordPress” section:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.independentcreator\.com$
RewriteRule ^(.*)$ http://www.independentcreator.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.html\ HTTP/
RewriteRule index\.html$ http://www.independentcreator.com/%1 [R=301,L]
Finally, I had a problem with this rule breaking WordPress comments: I had accidentally configured WordPress to use my site’s URL as “independentcreator.com” instead of “www.independentcreator.com” in the Options tab.
