When you upgrade from Sitefinity 3.2 to Sitefinity 3.5 it is possible to have invalid references which show as broken links or images on a page. The problems exists when there are white spaces or special characters in the names of the items before upgrade. The implementation of Images & Documents in Sitefinity 3.5 and more specifically urlWhitespaceChar makes old references to items with spaces in the names not valid.
This article represents two options about how to fix broken links and get them working with a new
urlWhitespaceChar. By default
urlWhitespaceChar is set to underscore(“_”).
First option:
This method changes links in
all Libraries and apply the new
urlWhitespaceChar declared in your
web.config file.
Steps:
1. Open your
web.config file.
2. Go to the following section:
| <cmsEngine defaultProvider="Generic_Content"> |
| <providers> |
| <clear /> |
| .... |
| <add name="Libraries" thumbnailExtention="" urlRewriteFormat="~/{Provider}/{LibraryName}/[Name].sflb.ashx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" applicationName="/Libraries" allowVersioning="False" allowLocalization="False" localizationProviderName="" allowWorkflow="False" securityProviderName="" versioningProviderName="" connectionStringName="GenericContentConnection" type="Telerik.Libraries.Data.DefaultProvider, Telerik.Libraries.Data" tagEditorTemplate="~/Sitefinity/Admin/ControlTemplates/Libraries/BatchTagsEditor.ascx" /> |
| |
| ... |
| </providers> |
3. Change the
urlWhitespaceChar (do not use white space "
") and reload the
Images & Documents module.
4. Go back to the
web.config and change any part of the highlighted line above. You could remove the “
~” char from the beginning of the
urlRewriteFormat string.
Save the
web.config file and
reload the module again. Check the links, they should be replaced with the new
urlWhitespaceChar.
5. Go back to the
web.config and put the “
~” on its place. Save and load the
Images & Documents module.
Second option:
This method applies only for a
selected Library, this is useful if you do not have a tons of items.
By using "
Batch edit" names and tags from
Images & Documents you can replace the links for the library you have chosen to edit.
The methods above replace the links in your libraries. If you have hardcoded links in your pages, using Sitefinity controls you should replace them manually.
The automation process is now available. You can download the tool from
Georgi Chokov's blog