var request = UmbracoContext.Current.PublishedContentRequest;
var found = ContentFinderResolver.Current.Finders.Any(x => x.TryFindContent(request));
If the URL is found, you can continue with the normal redirect. If not found, you can redirect to the non-de version.
Note that you may have to tinker with the above. I'm not sure if the list of finders includes the one that handles 404's (if so, found may always be true). Also, you may have to do something like clone the PublishedContentRequest and change the URL (e.g., if you need to add the "de" for the test).
404 Alternative
As an alternative, you could have your 404 page redirect to the non-de version of the page (if already on the non-de version of the page, the 404 would not do a redirect).
Multi language redirects
Hi,
I have web site with 2 language:
Also I have Action filter which check User IP and if this IP from Germany we user go to mysite.com/de. So this is working.
My problem is that I wold like to use main web site mysit.com/page1 for German users, because I don't have mysite.com/de/page1 node.
Also I don't want to include this url(s) into redirect action filter to skip.
Please advise....
Thanks, Mike
Something like this might work:
If the URL is found, you can continue with the normal redirect. If not found, you can redirect to the non-de version.
Note that you may have to tinker with the above. I'm not sure if the list of finders includes the one that handles 404's (if so,
found
may always be true). Also, you may have to do something like clone thePublishedContentRequest
and change the URL (e.g., if you need to add the "de" for the test).404 Alternative
As an alternative, you could have your 404 page redirect to the non-de version of the page (if already on the non-de version of the page, the 404 would not do a redirect).
Hi,
I found that getbyroute method can help me, but this method is not working for descendants. it works with "/" but didn't works with "/login/"
UmbracoContext.Current.ContentCache.GetByRoute("/login/", true);
Thanks, Mike
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.