Redirect old short asset path to new one with subdirectories

Hi there,
after upgrading to Neos 5 we had the complaint, that published urls to assets (in print-products or via mail or tinyurl) did not work anymore.
Since we see the benefit of the new structure, we wanted to use it but still have working old urls.
New default:
_Resources/Persistent/c/c/3/c/cc3c63fa96c62e9513183b3fe78e82c761443baa/myname.png
Old default: _Resources/Persistent/cc3c63fa96c62e9513183b3fe78e82c761443baa/myname.png
Christian Müller helped me to write an apache redirectRule, that does the trick.
Just in Case you have the same issue.

    RewriteRule ^_Resources/Persistent/(([a-z0-9])([a-z0-9])([a-z0-9])([a-z0-9])([a-f0-9]{36}))/(.*)$ _Resources/Persistent/$2/$3/$4/$5/$1/$7 [L,R=301]
2 Likes