如何在301redirect中使用旧URL的部分

是否有可能保留一个URL的某些部分,并重写其余部分? 使用.htaccess 301redirect

在我的例子中,我想重写这种格式的url

http://blog.example.com/post-name 

到这一个

 http://example.com/2014/post-name 

到目前为止,2014年(2014年)可能是静态的,因为只有一些链接会受到影响。

谢谢!

请记住,这将每个请求redirect到blog.example.com因为它只是在斜杠和redirect后捕获任何东西,所以请澄清,如果你需要它更聪明,但..

 RedirectMatch 301 ^/(.*)$ http://example.com/2014/$1