Enable mod_rewrite
and .htaccess
through httpd.conf
(if not already enabled) and then put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{SERVER_PORT}s ^(443(s)|\d+s)$
RewriteRule ^([0-9]{4}/[0-9]{2}/[0-9]{2}/[^/]+/?)$ http%2://sample.com/sub/sub2/$1 [L,QSA,R=301]