I have a hard time to create rewrite rule for a redirect using part of an old URL. Example:
Old URL: http://www.example.com/news/index.php/2014/11/07/my-blog-post-from-old-site or http://www.example.com/news/index.php/2014/11/07/my_blog_post_from_old_site
New URL: http://www.example.com/2014/11/07/my-blog-post
New URL should to have only dates and first three elements of a permalink after stripping from dashes. Even I'm not sure if can be done using .htaccess rule but for sure can be done using PHP.
Here are my .httaccess rules
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(/?news/index.php/.*/[^/]*?)_([^/]*?_[^/]*)$ $1-$2 [N]
RewriteRule ^(/?news/index.php/.*/[^/]*?)_([^/_]*)$ $1-$2 [R=301]
RewriteRule ^news/index.php/([^/]+)-([^/]+)-(.*)$ http://www.example.com/$1-$2-$3 [L,R=301,NC]