Redirect URL not removing the .html


After successfully migrating the WP site, I followed this tutorial:, for redirecting posts. The tutorial had me run a PHP script…

$res = $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink'");
foreach ($res as $row){
$slug = explode("/",$row->meta_value);
$slug = explode(".",$slug[3]);
$wpdb->query("UPDATE $wpdb->posts SET post_name ='" . $slug[0] . "' WHERE ID = $row->post_id");
echo "DONE";

…and then change the WP permalink structure to keep the .html on the end of post URLs (/%year%/%monthnum%/%postname%.html).

I hated having the .html in the URL though so I tried undoing the tutorial (changing the permalink structure back to /%year%/%monthnum%/%postname%/, running the PHP script again, deleted any permalink rewrites I had in .htaccess) and instead installed this redirection plugin. Unfortunately after pasting the plugin’s redirection code into Blogger and then trying to verify by testing the link, it is still not dropping the .html at the end of post URLs. I tried refreshing and resaving permalinks, but nothing is helping. I still get a 404 error.

Please help! I just need the .html to redirect to the URL without it, and it will work because when I manually delete it from the URL it takes me to the correct post.



Please save the permalink structure /%year%/%monthnum%/%postname%/, and do not delete .htaccess rules. It will automatically handle that. The redirection plugin code which you pasted in template is just provide redirection from blogger to WordPress, its don’t do anything related to permalinks. Also make sure that plugin always be active on WordPress site.

Thanks, –Nitun


I am having this same issue. My permalink structure is set to /%year%/%monthnum%/%postname%/. When I click the “verify configuration” button in the plugin, it says that it will redirect the random post to the correct path, without .html at the end. But it doesn’t. It still puts the .html at the end, which gives me a “not found” page on my wordpress site. I have to manually remove the .html, and obviously people are not going to know to do that. Please help!