I have a main site with two nodes winter / summer.
I want to redirect 301 the old url from mydomain.com/winter/ or -> mydomain.com/en/winter/ and mydomain.com/summer/ or -> mydomain.com/en/summer/
I have tried Skybruds.redirect but I can't use the full url, because It's not allowed. The path is coming from node. Is there any package that I can use or do I have to make redirects url in web.config? It's a lot of url:s in different sub categories
This sounds like a job for IIS redirect in your Web.Config (if I've understood correctly) because it seems like 'all the urls for winter and summer will be the same, but just with /en/ put in front'. With an IIS redirect rule you can 'pattern match' so you only need to specify a single rule to match all the redirects - whereas with Skybrud or similar you would need to have one entry for each url, to map to it's new url, which might be tons of Urls! (and the database access might be slow)
Now the thing with IIS redirects, are they are a bit fiddily and you almost always get it wrong first time and match too much or too little, or miss the closing slash or whatever, but once you have the right rules in, they will be very fast, as they will action in IIS, before Umbraco gets involved trying to handle the request.
Anyway, it's regexes as I say, so probably never works first time! but hopefully gives you the insight that if you play around with these two rules, it will match and redirect all the urls in one place.
Hi Marc and thanks for your help and comments. I think it's tricky with redirect rules but I get to learn more about regex :)
But I realize this is how I need to solve the problem.
Redirect url with category and two nodes
Hi I would like som help on best practice.
I have a main site with two nodes winter / summer. I want to redirect 301 the old url from mydomain.com/winter/ or -> mydomain.com/en/winter/ and mydomain.com/summer/ or -> mydomain.com/en/summer/
I have tried Skybruds.redirect but I can't use the full url, because It's not allowed. The path is coming from node. Is there any package that I can use or do I have to make redirects url in web.config? It's a lot of url:s in different sub categories
Many thanks! Christina
Hi Christina
This sounds like a job for IIS redirect in your Web.Config (if I've understood correctly) because it seems like 'all the urls for winter and summer will be the same, but just with /en/ put in front'. With an IIS redirect rule you can 'pattern match' so you only need to specify a single rule to match all the redirects - whereas with Skybrud or similar you would need to have one entry for each url, to map to it's new url, which might be tons of Urls! (and the database access might be slow)
Now the thing with IIS redirects, are they are a bit fiddily and you almost always get it wrong first time and match too much or too little, or miss the closing slash or whatever, but once you have the right rules in, they will be very fast, as they will action in IIS, before Umbraco gets involved trying to handle the request.
Lots of info here: https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference
but what you might end up with is two rules:
Where {R:0} is a 'back capture' which means the 'whole original url'
so a url like
winter/about-winter/anything
will become
/en/winter/about-winter/anything
and then duplicate the same rule for summer:
Anyway, it's regexes as I say, so probably never works first time! but hopefully gives you the insight that if you play around with these two rules, it will match and redirect all the urls in one place.
regards
Marc
Hi Marc and thanks for your help and comments. I think it's tricky with redirect rules but I get to learn more about regex :) But I realize this is how I need to solve the problem.
Thanks again for your support Christina
is working on a reply...