diff --git a/src/Umbraco.Core/UriExtensions.cs b/src/Umbraco.Core/UriExtensions.cs
index 42ef2ef72f..426d161f58 100644
--- a/src/Umbraco.Core/UriExtensions.cs
+++ b/src/Umbraco.Core/UriExtensions.cs
@@ -30,8 +30,6 @@ namespace Umbraco.Core
/// These are def back office:
/// /Umbraco/RestServices = back office
/// /Umbraco/BackOffice = back office
- /// /Umbraco/UmbracpApi = back office
- /// /Umbraco/UmbracoTrees = back office
/// If it's not any of the above, and there's no extension then we cannot determine if it's back office or front-end
/// so we can only assume that it is not back office. This will occur if people use an UmbracoApiController for the backoffice
/// but do not inherit from UmbracoAuthorizedApiController and do not use [IsBackOffice] attribute.
@@ -78,9 +76,7 @@ namespace Umbraco.Core
}
//check for special back office paths
- if (urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/UmbracoApi/")
- || urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/UmbracoTrees/")
- || urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/BackOffice/")
+ if (urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/BackOffice/")
|| urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/RestServices/"))
{
return true;
diff --git a/src/Umbraco.Tests/UriExtensionsTests.cs b/src/Umbraco.Tests/UriExtensionsTests.cs
index 9a6cfcae17..8e826fc428 100644
--- a/src/Umbraco.Tests/UriExtensionsTests.cs
+++ b/src/Umbraco.Tests/UriExtensionsTests.cs
@@ -23,8 +23,6 @@ namespace Umbraco.Tests
[TestCase("http://www.domain.com/test/umbraco.aspx", "", false)]
[TestCase("http://www.domain.com/Umbraco/restServices/blah", "", true)]
[TestCase("http://www.domain.com/Umbraco/Backoffice/blah", "", true)]
- [TestCase("http://www.domain.com/Umbraco/umbracoapi/blah", "", true)]
- [TestCase("http://www.domain.com/Umbraco/umbracotrees/blah", "", true)]
[TestCase("http://www.domain.com/Umbraco/anything", "", true)]
[TestCase("http://www.domain.com/Umbraco/anything/", "", true)]
[TestCase("http://www.domain.com/Umbraco/surface/blah", "", false)]
diff --git a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
index 833fe92906..2836c458fb 100644
--- a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
+++ b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
@@ -27,13 +27,20 @@ namespace Umbraco.Web.Mvc
/// The DataToken value to set for the 'umbraco' key, this defaults to 'backoffice'
/// By default this value is just {action}/{id} but can be modified for things like web api routes
/// Default is true for MVC, otherwise false for WebAPI
+ ///
+ /// If specified will add this string to the path between the umbraco path and the area path name, for example:
+ /// /umbraco/CUSTOMPATHPREFIX/areaname
+ /// if not specified, will just route like:
+ /// /umbraco/areaname
+ ///
///
///
internal static Route RouteControllerPlugin(this AreaRegistration area, string controllerName, Type controllerType, RouteCollection routes,
string controllerSuffixName, string defaultAction, object defaultId,
string umbracoTokenValue = "backoffice",
string routeTokens = "{action}/{id}",
- bool isMvc = true)
+ bool isMvc = true,
+ string areaPathPrefix = "")
{
Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName");
Mandate.ParameterNotNull(controllerSuffixName, "controllerSuffixName");
@@ -44,8 +51,10 @@ namespace Umbraco.Web.Mvc
var umbracoArea = GlobalSettings.UmbracoMvcArea;
- //routes are explicitly name with controller names and IDs
- var url = umbracoArea + "/" + area.AreaName + "/" + controllerName + "/" + routeTokens;
+ //routes are explicitly named with controller names and IDs
+ var url = umbracoArea + "/" +
+ (areaPathPrefix.IsNullOrWhiteSpace() ? "" : areaPathPrefix + "/") +
+ area.AreaName + "/" + controllerName + "/" + routeTokens;
Route controllerPluginRoute;
//var meta = PluginController.GetMetadata(controllerType);
diff --git a/src/Umbraco.Web/Mvc/PluginControllerArea.cs b/src/Umbraco.Web/Mvc/PluginControllerArea.cs
index d1e8cf4c1d..c6b3e7fe1e 100644
--- a/src/Umbraco.Web/Mvc/PluginControllerArea.cs
+++ b/src/Umbraco.Web/Mvc/PluginControllerArea.cs
@@ -85,7 +85,9 @@ namespace Umbraco.Web.Mvc
{
foreach (var s in apiControllers)
{
- this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api", isMvc: false);
+ this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api",
+ isMvc: false,
+ areaPathPrefix: s.IsBackOffice ? "backoffice" : null);
}
}
}