.htaccess 使用mod_重写清理URL

.htaccess 使用mod_重写清理URL,.htaccess,mod-rewrite,url-rewriting,.htaccess,Mod Rewrite,Url Rewriting,我正在尝试使用mod_rewrite清理我的URL 在我的URL中,我有: http://blog.com/cat/post1/index.html http://blog.com/cat/post2/index.html http://blog.com/cat/post3/index.html etc.... .htaccess RewriteEngine on RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP Rewr

我正在尝试使用mod_rewrite清理我的URL

在我的URL中,我有:

http://blog.com/cat/post1/index.html
http://blog.com/cat/post2/index.html
http://blog.com/cat/post3/index.html
etc....
.htaccess

RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP
RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
当我输入上述URL时,我得到:

http://blog.com/post1/
但我想:

http://blog.com/cat/post1/

我在这里做错了什么?

没有和我一起工作。它仍然重定向到“”,实际上我有多个URL需要更改(我编辑了文档),等等,嘿。我试过了,它说重定向在无限循环中,页面无法打开。谢谢。事实上,如果我在第二行中添加(.*)index\(php | html)$,它就工作了!谢谢你帮助我!
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP
RewriteRule (.*) http://blog.com/cat/$1 [R=301, L]