Sitecore Box

Sitecore web developer at Americaneagle.com

Sitecore Media Items Extensions and SEO


Introduction

Sitecore stored all media URLs that referenced inside RTE (Rich Text Editor) with .ashx extension. This will may cause a problem with old browsers that use the extension instead of applying the MIME type in the HTTP response header, and also for SEOs that allow filtering results by extension.


How to use the original extension?

A.   Change the settings for the uploaded files in the future.

To solve this problem we need to update the configuration for Sitecore to use the original file extensions rather than .ashx. To do so we need to update ‘Media.RequestExtension’ setting in config file.

What we should have to do is create new config file contains the below content and put the file under App_Config\Include folder:


B. How to force the RTE to add item extension instead of .ashx?

The big challenge here is how to update all media links which are already stored in RTE or File fields?

The below code snippet will solve this issue by looping on all items which have media links with .ashx extension and replace the extension with the original one:




0 comments:

Post a Comment