Wordpress Wednesdays: Permanent Redirect of Posts

Posted on November 28th, 2007

Many people may not know that Beyond the Rhetoric was originally hosted by GoDaddy and made use of their free QuickBlog software. It was very restrictive and that’s why I eventually moved the blog to Wordpress. Unfortunately for me, the default permalink structure with QuickBlog came with an .aspx extension for every post.

I wanted to keep any backlinks that I had, so I continued with the same permalink structure in Wordpress until just recently. I’ve been meaning to ditch the .aspx extension for some time, but I never really knew how. After all, none of my posts are actually in aspx. I didn’t want to lose backlinks, so I had to figure out a way to set up a permanent 301 redirect for all the posts. For that, I asked Matt for some help and he came through with flying colors.

As Matt described it, the code below is designed “so /2007/11/19/post-title.aspx permanently [301] redirects to /2007/11/19/post-title/”. The first part is to go into Wordpress and adjust the information in options/permalinks to the date/post-title structure. The second part is to insert this code into your .htaccess file, somewhere above the “# BEGIN WordPress” line.

# START Redirection of .aspx Extension
RewriteEngine On
RewriteBase /
RewriteRule ^/?([-a-zA-Z0-9/]+)\.aspx$ $1/ [R=301,L]
# END Redirection of .aspx Extension

I’ve implemented Matt’s code and it works like a charm. I’d imagine that the code would be nearly identical if you wanted to go from a /post-title.php permalink structure to a /post-title/ structure.

Posted in WordPress | 619 views


Related Topics:
Wordpress Wednesdays: Related Posts
Wordpress Wednesdays: Use Drafts to Your Advantage
WordPress Wednesdays: Live Blogroll
Wordpress Wednesdays: If Older Than
Wordpress Wednesdays: Custom Personalized Dashboard

RSS feed

1 Comment

Gravatar
Comment by ninja.s Subscribed to comments via email
2007-11-30 12:23:38

Great idea. Congrats on making the move. It’s hard to find someone who can help you out for free, count yourself lucky.

 

Sorry, the comment form is closed at this time.

© 2007 BlueFur Hosting | Privacy Policy
Theme by Unique Blog Designs