November Happy Hour will be moved to Thursday December 5th.

Per Magne Skuseth
Feb 6, 2013
  21328
(5 votes)

404 handler for EPiServer 7

The 404 handler is now available for EPiServer 7. Along with all the nifty features from the previous versions, a few new ones have been added:

  • Enterprise support: Full URLs are now supported, meaning that you may redirect to different pages, based on your domain name.
    Example: If you have an enterprise setup with two sites, site1.com and site2.com, an “old url” setting of
    http://site1.com/some/url” will only redirect for site1.com, not site2.com.
  • No more 302’s: The module has been modified to no longer give those unwanted 302 responses for non-friendly URLs. SEO-Geeks, I hope you’re happy!
  • Easier administration: Having hundreds of custom redirect suggestions that no longer are valid?  A new administration view in the gadget has been added for easier administration of deleting and importing redirects.

redirectsBlogClean

-A new EPiServer 7-ish look has been implemented as well.

 

AdministerCleanPointer 

-Easier administration.

 

Redirects and suggestions that are saved in the older version will remain intact while upgrading. The module works on both webforms and MVC templates. Get it as a NuGet package at the EPiServer Nuget Feed, or as an EPiServer module at https://www.coderesort.com/p/epicode/wiki/404Handler, where you’ll also find more documentation and screenshots.

Feb 06, 2013

Comments

vincent.yang@orchardmarketing.com.au

Can you give more detail instruction how to bring this to my dashboard? I installed this module via episerver nuget feed, however I can't see this from my Gadget

vincent.yang@orchardmarketing.com.au

I figured this out. I have to rebuilt the entire solution.

Per Magne Skuseth
Per Magne Skuseth Feb 12, 2013 08:36 AM

Rebuilding the solution should not be necessary, as there are no files to build. However, I have experienced a few times that a restart of the site is needed before the gadgets appear for the first time.

Feb 12, 2013 10:56 PM

Nice work!

Joel Abrahamsson
Joel Abrahamsson Feb 25, 2013 11:59 AM

Hi! Just wanted to say really nice work. Works like a charm!

mdaftari@verndale.com
mdaftari@verndale.com Mar 5, 2013 10:19 PM

worked like a charm, Can you share the sample XML to do import will be great, i tried guessing the format by refraction but its not working. This will be great help.

mdaftari@verndale.com
mdaftari@verndale.com Mar 5, 2013 10:32 PM

worked like a charm, Can you share the sample XML to do import will be great, i tried guessing the format by refraction but its not working. This will be great help.

Per Magne Skuseth
Per Magne Skuseth Mar 5, 2013 10:39 PM

You'll find a sample on this page, under "example configuration file": https://www.coderesort.com/p/epicode/wiki/404Handler/DocCms5#Custom404HandlerCMS4and5

mdaftari@verndale.com
mdaftari@verndale.com Mar 6, 2013 11:02 PM

Thanks.

Mar 15, 2013 02:51 PM

I found different behavior comparing the old one for the Epi6.
We had in web.config
our handler Custom404Handler : INotFoundHandler,, and also some settings in BVN handler gadget.
So if there was a 404 error and it was not found in the list of predefined setting in gadget, then our above handler was executed,
We installed the new version in Epi7. With the same settings, and our custom handler was never executed, but the settings from the gadget was used.
So we changed in web.config to .
In this case our handler is executed every time, but there is not used the gadget values.
All other settings are the same like on the sample page..
What can be?

Per Magne Skuseth
Per Magne Skuseth Mar 20, 2013 01:01 PM

Hi, Botond.
We'll follow this up on CodeResort. Thanks

tym.lawrence@netcat.com.au
tym.lawrence@netcat.com.au Apr 22, 2013 07:46 AM

We recently implemented the custom redirect 404 gadget for a CMS 7 site. This site has friendly urls, such as '/en/about-us/management-team/'

For some reason, the gadget is logging over 1100 custom redirect suggestions, which have a '/null' at the end - for example /en/about-us/management-team/null

An in each case, the referring page is itself (eg /en/About-Us/management-team/ )

I tried deleting all the suggestions, but they keep getting generated.

Has anyone seen this before or have any idea of how to solve this? Its quite urgent as the site is set to go live today and I'd really like the 404 suggestions to be meaningful.

tym.lawrence@netcat.com.au
tym.lawrence@netcat.com.au Apr 22, 2013 07:55 AM

I've now raised a defect for this issue - see ​https://www.coderesort.com/p/epicode/ticket/327.

Benjamin Vangansewinkel
Benjamin Vangansewinkel Jun 4, 2013 02:17 PM

Could you explain how to use it in MVC how do I replace the 404NotFound.aspx by a controller + view?

Thank you for this module.

Oct 8, 2013 06:55 PM

BUMP for the above comment.

Is there anyway out of the box you can create the page template using an MVC controller rather than a webform page?

Per Magne Skuseth
Per Magne Skuseth Oct 10, 2013 04:19 PM

For the current version, it is unfortunately not possible. Hopefully, I'll have the time to work on the next version real soon where I'll get rid of the aspx.

Isabel Zitoun
Isabel Zitoun Dec 2, 2013 01:37 PM

Hi Per,

I was wondering if you know anything about the lang-files for the 404-handler?

My site is on swedish as default, and it works very well when I enter a page that dosent exist. I get the 404 as planned. But when trying to reach the 404 from the English version of the site, it doesn't work. It still uses the Swedish lang-files?

Looks like it cant reach the first level? i.e www.mysite.se/firstlevel/etctect

Do you know anything about this?

Best regards
Isabel

Jan 14, 2014 04:33 PM

Was this ever updated for use with an MVC Controller?

Mads Storm Hansen
Mads Storm Hansen Feb 1, 2014 08:51 PM

Looks like Mark did a nice contribution for MVC controllers:

github.com/markeverard/BVN.404Handler.MvcContrib

Jonas Boman
Jonas Boman Apr 14, 2014 10:34 AM

I cant get redirects for urls with ".aspx" to work.

Using MVC with Razor. Request to a aspx-file just turns out blank with status 200.

kevin.miller@orchardmarketing.com.au

Hi,

We love your work on the BVN handler but we've come across a unique situation that I don't think is handled by the BVN module.

We have an old site URL which will be switched off and pointed at our EPiServer instance. We will need to redirect URLs from this other domain to another domain, which is not our EPiServer site (the site is a third party site that our EPiServer application is the front to).

So for example we need to redirect:

From: http://olddomain.com/this-old-page
To: http://third-party-site.com/new-page

Where our site URL would be https://episerver-site.com.

It seems that when you configure it this was the handler assumes that any redirect you are doing would be to a URL of the current site.

Is there anyway we could change the code to do this? We're happy to contribute to the code base if needed.

I realise we could use the UrRewrite module to do this and this might be what we do if we can't help change the code of the BVN handler.

Thanks,

Kevin

Minesh Shah (Netcel)
Minesh Shah (Netcel) Oct 13, 2014 11:28 AM

I have installed this via Nuget on an EPi 7.5 solution using MVC and am getting the following error when trying to use the gadget am i missing a reference in the redirects view ?

2014-10-13 10:10:02,571 [40] ERROR EPiServer.Global: 1.2.5 Unhandled exception in ASP.NET
System.Web.HttpCompileException (0x80004005): d:\DevRoot2013\xxx\xxx.com\Main\Src\xxx.com.2014\modules\BVNetwork.FileNotFound.RedirectGadget\Views\Redirect\Index.ascx(4): error CS1061: 'object' does not contain a definition for 'IsSuggestions' and no extension method 'IsSuggestions' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetCompiledType(String virtualPath)
at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetCompiledType(String virtualPath)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller)
at EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Per Magne Skuseth
Per Magne Skuseth Oct 15, 2014 12:34 PM

Check your modulesbin folder. There should be both BVNetwork.FileNotFound.RedirectGadget.dll and BVNetwork.EPi404.dll

David Sandeberg
David Sandeberg Dec 8, 2014 01:27 PM

I got the same error pointing to IsSuggestions. I think it has to do with the version of mvc that that is configured in /Modules/BVNetwork.FileNotFound.RedirectGadget/Views/Web.config. I removed the following:





Per Magne Skuseth
Per Magne Skuseth Dec 8, 2014 01:31 PM

Web.config, in the handler's view folder, should be removed

Thomas Hofmann
Thomas Hofmann Feb 6, 2015 04:06 PM

Hi, I'm migrating content to Epi and using this module to redirect traffic to published events

Event http://www.teknakurs.no/portal/page/portal/kurs/vis_arrangement?p_kp_id=44127 is found on several urls http://www.tekna.no/portal/page/portal/tekna/arrangementer/vis_arrangement?p_kp_id=44127&p_kurs_kalender=96473&frm_v01=&image.x=0&image.y=0

I want the rule to pick up the parameter p_kp_id=44127 from either url to redirect to a new EPi page, but it seems the _url is too long for it to find a match_. Shorter url's with the same parameter works fine. Any ideas how to solve this. Thanks!

Per Magne Skuseth
Per Magne Skuseth Feb 9, 2015 08:43 AM

Hi, Thomas.
I guess you could try to create implement an "INotFoundHandler". This will allow you to programatically handle every url that gives you an 404. Create a new class an implemented INotFoundHandler, then configure the 404 handler to use it. See an example of this configuration at https://www.coderesort.com/p/epicode/wiki/404Handler

Feb 17, 2015 01:53 PM

Just wanted to comment that we solved the above problem mentioned by Thomas. Since we had the IIS UrlRewrite module installed (for other use), the solution we found was to combine the two. Example:













This rule (in the Web.config) triggers *before* the URL is passed on to the BVN module.

Mats Stam
Mats Stam Jul 1, 2015 03:20 PM

Hey there, I have a question:

When you state no more 302:s. Does that mean the BVNetwork.FileNotFound.Handler.CustomFileNotFoundHandler's redirect? So when trying to use this with MVC I'm using BVN.404Handler.MvcContrib, which seems to do the correct 301 redirect, but all that happens after there's a 302 when using the 3.1.2 version of your project :)

What am I missing? =P

Jul 21, 2015 04:01 AM

Hi,

I added the https://www.coderesort.com/p/epicode/wiki/404Handler as well as https://github.com/markeverard/BVN.404Handler.MvcContrib to website on episerver 7 version.

What is working perfectly fine is : When i add redirect mapping from the gadget it works as expected.

I am struggling to redirect to a view placed in shared folder when 404 is encountered.

Basically i want to redirect to some friendly view instead of default implementation.

Existing settings in config:

 

 

/Not found is a notfound.cshtml inside /view/shared/notfound.cshtml.

Can some one suggest what changes do i need to make to make the custom redirect work.

Thanks in Advance.

Kevin Miller
Kevin Miller Nov 27, 2015 04:01 AM

Can I ask a question? Where does this module store the key/values? I ask as I've added two with the same key somehow. I want to delete one, so would like to know where to do this.

Vahid
Vahid May 28, 2021 04:53 AM

Hi 

I can't find this screen . Where can I find that?

redirectsBlogClean

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog