When I first moved existing content to this domain, I had a pile of tags coming from Movable Type with underscores (“_”) in them. Upon getting them into the new database, I changed the underscores to hyphens using a SQL script, but then had to worry about redirecting old links to new. I wound up with a very long .htaccess file full of 301 directives that looked like this:
Redirect 301 /tag/tags_with_underscores/ https://michaelgracie.com/tag/tags-with-underscores/
With the upgrade to WordPress 3.1, I started having problems with URL rewrites – the culprit wound up being the Advanced Permalinks plugin. That plugin had been used as a patch, allowing pretty permalinks to function alongside some stray special characters such as periods (“.”). Once I disabled it I was forced to clean up those special characters, and it then dawned on me that this list of redirects was WAY too long. So I set out to conjure another solution for the original underscore issue. After significant research, followed by too much trial and error, this is what I came up with…
If you are using clean URLs, WordPress has inserted this chunk of code into your site’s .htaccess file:
# 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]
</IfModule>
# END WordPress
Inserting this additional code in between “RewriteBase /
” and “RewriteRule ^index\.php$ - [L]
” will change the underscores in individual tags to hyphens:
#begin permanent tag fix
RewriteRule ^tag/([^_]*)_([^_]*)_([^_]*)_([^_]*)$ tag/$1-$2-$3-$4 [L,R=301]
RewriteRule ^tag/([^_]*)_([^_]*)_([^_]*)$ tag/$1-$2-$3 [L,R=301]
RewriteRule ^tag/([^_]*)_([^_]*)$ tag/$1-$2 [L,R=301]
#end permanent tag fix
Comment/Trackback spam to get scored
Movable Type has a new version of their blog software now in beta. Included in the latest feature set are a variety of admin tools, and a new comment/trackback spam filtering system. The new spam enhancements are supposed to work like traditional Bayesian spam filters, scoring comments and trackbacks according to relevance, and dropping the garbage into a junk folder.
I’ll send over a report after testing, post-beta of course.
July 15, 2005 Add Comment