.htaccess Htaccess删除多个子字符串或隐藏子目录

.htaccess Htaccess删除多个子字符串或隐藏子目录,.htaccess,url-rewriting,.htaccess,Url Rewriting,我想用htaccess将上面的url重写为以下内容 http://www.example.com/blog/demo/first-post http://www.example.com/blog/test/second-post 简单地说 如果请求的uri包含子字符串“blog”,则应删除“blog”和下一项,并将剩余部分与第一部分合并 谢谢 http://www.example.com/first-post http://www.example.com/second-post Rewrit

我想用htaccess将上面的url重写为以下内容

http://www.example.com/blog/demo/first-post
http://www.example.com/blog/test/second-post
简单地说

如果请求的uri包含子字符串“blog”,则应删除“blog”和下一项,并将剩余部分与第一部分合并

谢谢

http://www.example.com/first-post
http://www.example.com/second-post
RewriteRule ^/blog/.*?/(.*)$  $1  [NC,L]