Sciencetext Tips & Tricks
Blogging tips, browsing tricks and computing hacks

Blogger to Hosted Wordpress

 

February 2nd, 2007 · by David Bradley

As readers will hopefully have realised by now, Significant Figures was formerly a Blogspot blog and is now part of the new ScienceText.com site. We’ve had a few teething troubles with redirects and missing themes, and broken links and the like that I’ve mashed out in these pages over the last couple of days in the form of hopefully generally useful Tips&Tricks for others in a similar predicament. Well, the latest, and hopefully last thing to iron out was the old references in the search engines and elsewhere to specific posts from the archives.

As the new blog architecture renders URLs with the postname.html in the root of the domain e.g. www.sciencetext.com/this-post-here.html there were numerous links from the old Blogger archives that were trying to open www.sciencetext.com/2006/11/this-post-here.html. This was producing a preponderance of 404 missing page error messages.

The fix involves opening the root .htaccess file and adding the following code. This does a rewrite on the incoming URL and strips out any sub-folder structures (with numbers), adds the .html to the end and then opens the page as if it were in the root folder as it should

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]{4})/([0-9]{1,2})/([^/]+).html$ $3\.html [QSA,R,L]
</IfModule>

I figured this out with the help of the Wordpress forum, but it required some tweaking of Otto42’s solution on that page to get it work just right.

If you have a similar problem moving an old blog to new hosting with posts in a different folder then you should be able to adapt this piece of code to work for you. If there are letters in the folder names as well as numbers, then you need to add [A-Z][a-z] to encompass those in the script.

1 response so far ↓

Leave a Comment

Comments are checked for spam before appearing, no need to post it twice.

Related Posts