.htaccess中删除多个子或隐藏子目录(S)多个、子目录、htaccess

2023-09-02 09:45:10 作者:在平淡生活里创造惊喜

  http://www.example.com/blog/demo/first-post
http://www.example.com/blog/test/second-post
 

我想重写上述网址与htaccess的下面,

  http://www.example.com/first-post
http://www.example.com/second-post
 

简单地说,

没下载完可以直接删除易升吗

如果请求的URI包含子'博客',应该删除'博客',下一个项目,concatinate遗体与firstpart

感谢

解决方案

 重写规则^ /博客/.*?/(.*)$ $ 1 [NC,L]
 

http://www.example.com/blog/demo/first-post
http://www.example.com/blog/test/second-post

I would like to rewrite the above url to following with htaccess,

http://www.example.com/first-post
http://www.example.com/second-post

Simply,

If requested uri contains substring 'blog' it should remove 'blog' and the next item and concatinate the remains with firstpart

Thanks

解决方案

RewriteRule ^/blog/.*?/(.*)$  $1  [NC,L]