我刚从Wordpress转移到另一个CMS。
很抱歉,如果之前已经问过这个问题(我确定已经有问题了,但我浏览了大约30个帖子而且找不到我需要的内容)
我需要更改我的htaccess文件,以便旧网址重定向到新格式。
旧网址格式: www.mysite.com/my-post /
新网址格式: www.mysite.com/my-post.html
我需要完全相反:HTACCESS - Replace everything ending html with a trailing slash
请帮忙!
答案 0 :(得分:-1)
这应该重定向以.html
为正斜杠结尾的所有内容,以便example.com/test/
变为example.com/test.html
,但example.com/test
将不会被修改(不会以正斜杠结尾)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (.*)/ /$1.html [R=301,L]
</IfModule>