Rewrite/Redirect all “someaddress.html” pages to “someaddress/” WordPress

I recently migrated my website – and part of this migration was changing from static html to a wordpress website. All of my links to my site still use the following scheme: mysite.com/{year}/{month}/somepost.html whereas my new scheme is mysite.com/{year}/{month}/somepost/

How can I redirect (301) using mod_rewrite all URLs with the old pattern to the new one?

Related posts

1 comment

  1. Using mod_rewrite you can set your .htaccess file to redirect the incoming links from http://example.com/2004/04/title_of_post.html to http://example.com/2004/04/title-of-post/ by:

    RewriteEngine on
    RewriteRule ^([0-9]{4}/[0-9]{1,2}/.*).html $1/ [R=301,L]
    

    There is also a plugin for wordpress, you may have a look link

Comments are closed.