Strange error when creating a new page - Home page alias is deleted

Topics: General, Troubleshooting
Feb 16, 2015 at 5:52 AM
I have a strange error on a v. Orchard site.

When a new page is created I get the message:

Would you like to add a widget layer for ""?

and then

Would you like to add a widget layer for "[name-of-new-page]"?

And then the homepage "/" is gone a 404 is returned and I have to edit the homepage content item and reset as homepage.

Anyone experienced similar and have a fix?

Error logs aren't helping..

Thanks for any pointers.
Feb 27, 2015 at 10:15 PM
Edited Feb 27, 2015 at 10:26 PM
Still can't figure this one out!

For whatever reason when I add a new page the homepage record in [Orchard_Alias_AliasRecord] gets deleted..? Anyone any notion why this would occur as I'm stumped..

I have an older SDF of the site and when I run the code against that it doesn't delete the homepage - i.e. it works as it should. But when I run it against the production database it loses the homepage alias everytime a new page is added.
Feb 27, 2015 at 11:01 PM
Maybe there's something weird with your aliases. I don't know if that feature already exists in 1.7.1, but look for the Alias UI feature and enable it. Look for (multiple) aliases that are set to '/'. I can't recall the exact details, but I experienced something similar and the issue had something to do with a weird alias.
Feb 28, 2015 at 12:46 AM
Edited Feb 28, 2015 at 12:46 AM
Thanks for the tips sfmskywalker I already had that module enabled - experimented with the turning the alias UI and Alias modules (as well as a bunch of others!) on and off just for good measure.

In the table [Orchard_Alias_AliasRecord] when I 'set as homepage' the Path record is a blank string - '' - there aren't any duplications of this in the table.

One other weird fact is that when I have set the Homepage then create another page I get the message

Would you like to add a widget layer for ""?
and then
Would you like to add a widget layer for "[name-of-new-page]"?

And when I look in the table the Alias for the Homepage has been deleted...

Feb 28, 2015 at 1:07 AM
Interestingly the database size seems excessive.. 128mb and the client just adds standard content as usual
Feb 28, 2015 at 1:34 AM
Edited Feb 28, 2015 at 1:43 AM
Also I tried deleting all the Aliases on a test version, but the behaviour still persists. As mentioned before I have an older version of the site that is an SDF and running against the same code it doesn't do this.

I deleted all items out of Orchard_Autoroute_AutoroutePartRecord also in case there was a rogue record in there but same issue.

It's almost as if some of the page content are not tied to the correct ids.
Feb 28, 2015 at 11:12 PM
The only way I've found to repro the same kind of behavior (not exactly the same) is by setting an improper autoroute pattern in the page content type settings. So, in the "Content Definition" of the "Page" content type, in the "Autoroute" part settings, check if the current "Pattern" is properly set, e.g: {Content.Slug} with no extra characters...

Feb 28, 2015 at 11:29 PM
I checked that but nothing weird in there.

Is there a way to hardcode a route to the homepage?
Mar 1, 2015 at 1:28 AM
Edited Mar 1, 2015 at 1:41 AM
For the route pattern, take care only one extra character (e.g a space) can corrupt it. To test it, try to create a page and input manually the url slug without using the automatic url generation, and publish

Just tried it, seems to work but tested on a 1.x version. In one of my modules that I've enabled, in the Route.cs file I've added this route provider with a RouteDescriptor that uses an hardcoded Id. So, edit your home page, input an non empty url slug, go to the alias UI to see the Id number of this page, and use it in the RouteDescriptor

Note: In terms of SEO, you will have two urls with the same content, but you can correct this with some webmaster tools or with some html attributes that specify the original url (right now, I don't remember)
using System.Web.Mvc;
using System.Web.Routing;

namespace Evolutive.Automation.Routes {
    public class HomePageRoutes : IRouteProvider {

        public void GetRoutes(ICollection<RouteDescriptor> routes) {
            foreach (var routeDescriptor in GetRoutes())

        public IEnumerable<RouteDescriptor> GetRoutes() {
            return new[] {
                new RouteDescriptor {
                    Priority = 150,
                    Route = new Route(
                        new RouteValueDictionary {
                            {"area", "Contents"},
                            {"controller", "Item"},
                            {"action", "Display"},
                            {"Id", YourHomePageId}
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "Contents"}
                        new MvcRouteHandler()

Marked as answer by beebul on 3/1/2015 at 1:41 PM
Mar 1, 2015 at 8:41 PM
Brilliant thanks - I've used this technique!

Cheers for your assistance.