Try our conversational search powered by Generative AI!

URL Rewrite provider issue

Vote:
 

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:

namespace Fus.Digital.Business
{
    public class SeoFriendlyUrlRewriter : FriendlyUrlRewriteProvider
    {

I'm getting..

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!

#91341
Oct 03, 2014 3:18
Vote:
 

Hi, 

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?

I don't quite get your second question?

Regards.

/Q

#91344
Oct 03, 2014 6:08
Vote:
 

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.

#91346
Oct 03, 2014 6:51
Vote:
 

Yes, I think you don't have to add that section. It should work fine. HierarchicalUrlRewriteProvider is the default one since EPiServer 7.

/Q

#91347
Oct 03, 2014 7:01
Vote:
 

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/

#91378
Oct 03, 2014 13:41
Vote:
 

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!

#91476
Oct 07, 2014 0:13
Vote:
 

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;
                if (!ContentReference.IsNullOrEmpty(contentLink))
                {
                    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;
                    }
                }
            };
#91542
Oct 08, 2014 13:28
Vote:
 

Ahh fantastic! I just added this to an Initialization Module and worked like a charm. Thanks so much.

Cheers Ben

#109732
Oct 14, 2014 0:13
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.