sitecore8.1 - Sitecore MVC does not give error for .aspx pages -
we using sitecore 8.1 mvc format. discovered if have link like: mywebsite.com/about or mywebsite.com/contact
if write mywebsite.com/about.aspx works page there. desired functionality? if don't want have version without .aspx how can that? possible?
edit: how url's being generated:
<linkmanager defaultprovider="sitecore"> <providers> <clear /> <add name="sitecore" type="sitecore.links.linkprovider, sitecore.kernel" addaspxextension="false" alwaysincludeserverurl="false" encodenames="true" languageembedding="always" languagelocation="filepath" lowercaseurls="false" shortenurls="true" usedisplayname="false" /> </providers>
this sitecore default behavior, can do, redirect .aspx
page correct url, keep addaspxextension="false"
in sitecore link manager configuration, , add following code main layout :
string itemurl = sitecore.links.linkmanager.getitemurl(sitecore.context.item); if (itemurl != request.path) { response.redirect(itemurl); }
Comments
Post a Comment