we have the below configuration with Sitecore 9.3
<encodeNameReplacements>
<replace mode="on" find=" " replaceWith="-" />
</encodeNameReplacements>
When there is a media item with space in its name. e.g. "Test Media Item.pdf", the Url generates as www.test.com/-media/Test-Media-Item.pdf
, when we use the item in RTE or Item link.
www.test.com/-media/Test-Media-Item.pdf
- redirects to 404 page as item not found. If I try to access directly as www.test.com/-media/Test Media Item.pdf
replacing "-" with "" able to browse the file directly.
This works fine for Sitecore items. e.g. for an item with name "Test Item". Url www.test.com/test-item
works fine
"-" has to be present in the item name and we can not remove the encodeNameReplacements rule as we have too many deeplinks to the sitecore pages from other websites.
On a separate note, we were able to access the same item with Url www.test.com/-media/Test-Media-Item.pdf
on Sitecore 8.2. But its redirecting to 404 after upgrading to Sitecore 9.3. Could not find any custom media handler that would made it work on Sitecore 8.2.
Have checked the below articles.
https://briancaos.wordpress.com/2017/12/08/sitecore-replace-spaces-with-dashes-in-urls/
Can we handle this use case with a custom media handler may be ?
Please suggest.