We have decided to implement a URL Rewrite provider but i'm have major issues just getting the xml to find my custom provider.
I'm new to providers in general so i'm really not sure if "Fus.Digital.Business.SeoFriendlyUrlRewriter,Fus" is correct to call:
public class SeoFriendlyUrlRewriter : FriendlyUrlRewriteProvider
Configured provider type SeoFriendlyUrlRewriter could not be loaded
as a result.
Issue #2: In any writing i've seen they've added..
But adding this causes the error: The entry 'HierarchicalUrlRewriteProvider' has already been added.
Is this added automatically in 7.5 or do I still need to worry about it?
I'd really appreciate any help on this as I'm pulling out hair!
type="Fus.Digital.Business.SeoFriendlyUrlRewriter,Fus" is the full type name of your url rewriter module, where Fus should be the name of the assembly. Do you compile to Fus.dll or other name?
"Fus.Digital.Business.SeoFriendlyUrlRewriter,Fus" is the full type name of your url rewriter module, where Fus should be the name of the assembly. Do you compile to Fus.dll or other name?
I don't quite get your second question?
Thanks so much for your help! I have now a provider that's working :)
My second question was do I need to add in HierarchicalUrlRewriteProvider, EPiServerIdentityUrlRewriteProvider, EPiServerNullUrlRewriteProvider to the episerver.config as this is what the blog posts say to do but it errors when I try. I'm thinking it might have changed in V7 that you don't require them. Works without so i'm not too fussed if youre not sure.
Yes, I think you don't have to add that section. It should work fine. HierarchicalUrlRewriteProvider is the default one since EPiServer 7.
What is the purpose of writing a custom URL provider?
Reason I ask is that FURL providers where mainly used in pre CMS7, they still live in CMS7 but mostly for backward compability reason. From CMS7 and forward .NET routing is used for ingoing/outgoing routing so any customization of URLs is recommended to be based on routing and not FURL providers.
See e.g. http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/7/Routing/Routing/
Thanks so much for your interest. Yes once I got the provider working I found out it wasn't going to fix my issue. So the purpose of this was the client has requested different different URL's than what appears in the site structure for SEO purposes.
I used the simple address field and wrote a custom method to route to the simple URL. The problem with this though was the links in the WYSIWYG were resolving to the default URL. I'm relativly new to MVC so didn't know the full scope of the MVC inbuilt routing. I'll look in to this, thanks again!
One option for that could be to hook up an eventhandler to ContentRoute.CreatedVirtualPath.
in the eventhandler you can check if the routed page has an simple address definied and if so change url to it. Something like:
ContentRoute.CreatedVirtualPath += delegate(object source, UrlBuilderEventArgs args)
var contentLink = args.RouteValues[RoutingConstants.NodeKey] as ContentReference;
var lang = args.RouteValues[RoutingConstants.LanguageKey] as string;
var langSelector = String.IsNullOrEmpty(lang) ? LanguageSelector.AutoDetect() : new LanguageSelector(lang);
var page = ServiceLocator.Current.GetInstance().Get(contentLink, langSelector) as PageData;
if (page != null && !String.IsNullOrEmpty(page.ExternalURL))
args.UrlBuilder.Path = page.ExternalURL;
Ahh fantastic! I just added this to an Initialization Module and worked like a charm. Thanks so much.