0

I've just moved from Wordpress to a different CMS.

Sorry if this question has been asked before (I'm sure it has, but I browsed about 30 posts and didn't find what I need)

I need to change my htaccess file so that old urls redirect to new format.

OLD URL format: www.mysite.com/my-post/

NEW URL format: www.mysite.com/my-post.html

I need exactly the opposite of this: HTACCESS - Replace everything ending html with a trailing slash

Please help!

Community
  • 1
  • 1

1 Answers1

-1

This should redirect anything that ends in a forward slash with .html so example.com/test/ becomes example.com/test.html, but example.com/test would be unmodified (does not end in a forward slash).

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (.*)/ /$1.html [R=301,L]
</IfModule>
doublesharp
  • 26,888
  • 6
  • 52
  • 73