A followup to WordPress 2.5 Permalink Redirect Plugin Issues

After being frustrated with the permalink redirect problems I was having last month I pretty much stopped writing anything. It was not just the permalink issues that caused me to stop it was the mad rush to get everything ready for our daughter who is now just days away from being born.

After quite a bit of putzing around with wordpress I finally gave up and used mod_rewrite to fix the urls. The changes I made can be explained like this.

If mod_rewrite is available, turn the rewrite engine on, set the rewrite base to the root of the url. The RewriteRule works like this, Any request made to this site for example this post: /2008/06/15/a-followup-to-wordpress-25-permalink-redirect-plugin-issues.html. The bolded part of the request is stored in $1 and redirected to /2008/06/15/a-followup-to-wordpress-25-permalink-redirect-plugin-issues with a 301 (moved permanently). the new request for /2008/06/15/a-followup-to-wordpress-25-permalink-redirect-plugin-issues is then handled normaly by wordpress.

That is the contents of my .htaccess file and so far it seems to be doing just what I wanted.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*).html$ /$1 [R=301,L]
</IfModule>

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

# END WordPress

Be Sociable, Share!