1
votes

I want to have stack overflow like url pattern in orchard blog. How to achieve it with Auto route pattern. For example I want to have a pattern like

/myblog/Pages/4453/what-ever-title

Here, regardless of the trailing page name (what-ever-title) I want to always point to the item 4453. I have tried following pattern but failed.

{Content.Container.Path}/Pages/{Content.Id}

{Content.Container.Path}/Pages/{Content.Id}/*

{Content.Container.Path}/Pages/{Content.Id}/{Content.Slug}

The reason I want this is that I can then change the page final url without affecting the links already being built in SEO efforts.

for instance for this question stack overflow url is

/questions/24145078/how-match-any-in-orchard-cms-auto-route

Regardsless of what I use for trailing part as long as the number 24145078 is there the url works fine.

1

1 Answers

2
votes

This is not how autoroute works. Autoroute is not routing, it's generating unique paths for content items, based on token-driven rules. I you want a wildcard route, write a wildcard route.

But for this specific appliation, I'm afraid that's still not what you should do. The standard way of dealing with resources that move to a new address is to establish a permanent redirect from the old URL to the new. This is most efficiently done using the URL rewriting feature of IIS.