user3811724
user3811724

Reputation: 21

Umbraco 7 - Alternative URLs

I am using Umbraco 7 and I need to achieve something which I am not entirely sure of the best way to approach it.

Basically I have vacancies on a website that have URLs currently such as this:

/vacancies/a/almighty-school/live/first-year-teacher/

What I want is for the URL to NOT show the /a and /live part (which are needed for structuring in the administration area), so basically the above URL would be:

/vacancies/almighty-school/first-year-teacher

I am not entirely sure of the best way of doing this, I know about URL Rewriting but am not sure if that could do this and if it could I really am not that clued up on the regular expressions needed to create it.

Any ideas anyone??

Upvotes: 2

Views: 2587

Answers (2)

sebastiaan
sebastiaan

Reputation: 5917

I think the best way to tackle this is to create your own Segment Provider:

When the URL is build up, umbraco will convert every node into a segment. Each published Content has a url segment.

The documentation for manipulating these segments can be found here: http://our.umbraco.org/documentation/Reference/Request-Pipeline/outbound-pipeline

Upvotes: 0

Jamie Howarth
Jamie Howarth

Reputation: 3323

Add a property called umbracoUrlAlias, type Textstring, to your document type. Set the value to be "/vacancies/almighty-school/first-year-teacher".

This is a "magic string" that will then allow the document to be accessed via an alternate URL.

You could also set up a ContentService.Saving event to automatically set the value of this on the given node according to some preset rules.

Upvotes: 7

Related Questions