SaaS CMS has officially launched! Learn more now.

Per Magne Skuseth
Feb 6, 2013
(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, and, an “old url” setting of” will only redirect for, not
  • 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.


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



-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, where you’ll also find more documentation and screenshots.

Feb 06, 2013


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

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! 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. 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": Mar 6, 2013 11:02 PM


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 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. Apr 22, 2013 07:55 AM

I've now raised a defect for this issue - see ​

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

Do you know anything about this?

Best regards

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:

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.


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:


Where our site URL would be

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.



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\\Main\Src\\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 is found on several urls

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

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


I added the as well as 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 May 28, 2021 04:53 AM


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


Please login to comment.
Latest blogs
Optimizely release SaaS CMS

Discover the future of content management with Optimizely SaaS CMS. Enjoy seamless updates, reduced costs, and enhanced flexibility for developers...

Andy Blyth | Jul 17, 2024 | Syndicated blog

A day in the life of an Optimizely Developer - London Meetup 2024

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024