How to make 301 redirect in Umbraco 9+ / a .NET Core view?
I have Umbraco 11 and in the navigation editors can add Multi Url Picker items (doc type "ExternalUrl"). This is used for having navigation items pointing to external url or media items.
When rendering the navigation I make sure to check if the item is doc type "ExternalUrl" and change the href accordingly:
I will use the above since there is only one page in the solution that uses it and no one really ever should "meet" the template since there is no links to the "page"
How to make 301 redirect in Umbraco 9+ / a .NET Core view?
I have Umbraco 11 and in the navigation editors can add Multi Url Picker items (doc type "ExternalUrl"). This is used for having navigation items pointing to external url or media items.
When rendering the navigation I make sure to check if the item is doc type "ExternalUrl" and change the href accordingly:
But I would like to handle visitors visiting the url, i.e. www.mydomain.com/my/external/url/document
Therefore: In my ExternalUrl.cshtml template, how should I do that?
For now I have made i JavaScript, but thats not very SEO friendly:
Hi Martin,
Ideally you should be doing this either in a controller or with some middleware, you really shouldn't be redirecting from a view.
If you really must then you could just do a response .redirect
The return is important.
Cool, thanks.
I will use the above since there is only one page in the solution that uses it and no one really ever should "meet" the template since there is no links to the "page"
is working on a reply...