I'm running a site with multiple languages, where a page may have the same URL for multiple languages (after the language code). For example:
English: /page-name
German: /de-de/page-name
Italian: /it-it/page-name
If the name of this page is changed, there will be a redirect added for each language, each stored as a row in the umbracoRedirectUrl table. All will have the same url and the cultures will be different.
Now when I go to the old URL (/page-name), this code in ContentFinderByRedirectUrl will execute to try to redirect me to the new URL:
public bool TryFindContent(PublishedRequest frequest)
{
var route = frequest.HasDomain
? frequest.Domain.ContentId + DomainUtilities.PathRelativeToDomain(frequest.Domain.Uri, frequest.Uri.GetAbsolutePathDecoded())
: frequest.Uri.GetAbsolutePathDecoded();
var redirectUrl = _redirectUrlService.GetMostRecentRedirectUrl(route);
if (redirectUrl == null)
{
_logger.Debug<ContentFinderByRedirectUrl>("No match for route: {Route}", route);
return false;
}
var content = frequest.UmbracoContext.Content.GetById(redirectUrl.ContentId);
var url = content == null ? "#" : content.Url(redirectUrl.Culture);
...
}
This seems to be getting the most recently added redirect url for the path, without looking at the culture in the request. This could be the redirect url for any culture, because they were all added at the same time and they all have the same url - they only vary by culture.
The last line above then uses redirectUrl.Culture to get the final url. Shouldn't this be using frequest.Culture.ToString() instead?
Redirect URLs in multi-language site
I'm running a site with multiple languages, where a page may have the same URL for multiple languages (after the language code). For example:
If the name of this page is changed, there will be a redirect added for each language, each stored as a row in the umbracoRedirectUrl table. All will have the same url and the cultures will be different.
Now when I go to the old URL (/page-name), this code in ContentFinderByRedirectUrl will execute to try to redirect me to the new URL:
This seems to be getting the most recently added redirect url for the path, without looking at the culture in the request. This could be the redirect url for any culture, because they were all added at the same time and they all have the same url - they only vary by culture.
The last line above then uses redirectUrl.Culture to get the final url. Shouldn't this be using frequest.Culture.ToString() instead?
is working on a reply...