简体   繁体   中英

301 Redirect old Wordpress URL to new one

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!

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM