I have the following tree structure in my umbraco back office
and for each vehicle manufacturer (mercedes, Ford, Vauxhall) the node does not link to a template so if the user is to type the absolute url into the browser they will hit the following page not found page.
The manufacturer nodes are mainly used for placeholders so i would like to create a redirect to the parent node our-vehicles.aspx if the user was to type in the www.mysite.co.uk/our-vehicles/mercedes.aspx.
I have looked into both umbracoUrlAlias and umbracoUrlName but neither seem to work (unless im doing something wrong?)
Can anyone suggest what i can do in this situation please?
you can create a new template and set this to default for manufacturer nodes. In this new template you write only a 301 permanent redirect to the parent node, maybe like this:
@{HttpContext.Current.Response.Clear();HttpContext.Current.Response.Status="301 Moved Permanently";HttpContext.Current.Response.AddHeader("Location", Model.Parent.Url);HttpContext.Current.Response.End();}
Thanks for your prompt reply! I have created a new template called vehicle manufacturer and placed the code that you referenced in into it. I have mapped the vehicle manufacture node types to use the template but i am still seeing the error.
I have tried to create a razor script file and put that in the template and although i see no error it doesnt cause a redirect.
Ive never done this type of thing before so apologies if i am missing something.
Redirect any nodes URL's which dont utilise a template
Hi all,
I have the following tree structure in my umbraco back office
and for each vehicle manufacturer (mercedes, Ford, Vauxhall) the node does not link to a template so if the user is to type the absolute url into the browser they will hit the following page not found page.
The manufacturer nodes are mainly used for placeholders so i would like to create a redirect to the parent node our-vehicles.aspx if the user was to type in the www.mysite.co.uk/our-vehicles/mercedes.aspx.
I have looked into both umbracoUrlAlias and umbracoUrlName but neither seem to work (unless im doing something wrong?)
Can anyone suggest what i can do in this situation please?
Thanks
Paul
Hi Paul,
you can create a new template and set this to default for manufacturer nodes. In this new template you write only a 301 permanent redirect to the parent node, maybe like this:
Hope this helps.
Best,
Sören
Hey Soren,
Thanks for your prompt reply! I have created a new template called vehicle manufacturer and placed the code that you referenced in into it. I have mapped the vehicle manufacture node types to use the template but i am still seeing the error.
I have tried to create a razor script file and put that in the template and although i see no error it doesnt cause a redirect.
Ive never done this type of thing before so apologies if i am missing something.
Just to confirm i am using umbraco 6.2
Cheers
Paul
Ignore that last reply your code fixed it!
Thats exactly what i needed :)
Thank you!! You have really helped me out :)
Thanks
Paul
is working on a reply...