diff --git a/be/src/Unic.UrlMapper2/code/Services/RedirectSearcher.cs b/be/src/Unic.UrlMapper2/code/Services/RedirectSearcher.cs index 900f531..6561107 100644 --- a/be/src/Unic.UrlMapper2/code/Services/RedirectSearcher.cs +++ b/be/src/Unic.UrlMapper2/code/Services/RedirectSearcher.cs @@ -96,7 +96,7 @@ protected virtual void HandlePreserveQueryString(Redirect redirect, string sourc redirect.RegexEnabled = true; if (!sourceTerm.Contains("?")) { - redirect.Term = $"{sourceTerm}{Constants.RegularExpressions.QueryStringPattern}$"; + redirect.Term = $"^{sourceTerm}{Constants.RegularExpressions.QueryStringPattern}$"; return; } @@ -104,7 +104,7 @@ protected virtual void HandlePreserveQueryString(Redirect redirect, string sourc var addSourceTermQuery = !sourceTerm.EndsWith("?"); var sourceTermQuery = addSourceTermQuery ? sourceTerm.Substring(sourceTerm.IndexOf("?", StringComparison.InvariantCultureIgnoreCase) + 1) : string.Empty; - redirect.Term = $"{sourceTermPath}{(addSourceTermQuery ? $"([?]{sourceTermQuery}{Constants.RegularExpressions.PartialQueryStringPattern})" : Constants.RegularExpressions.QueryStringPattern)}$"; + redirect.Term = $"^{sourceTermPath}{(addSourceTermQuery ? $"([?]{sourceTermQuery}{Constants.RegularExpressions.PartialQueryStringPattern})" : Constants.RegularExpressions.QueryStringPattern)}$"; } protected virtual IQueryable GetSearchQuery(IProviderSearchContext searchContext, RedirectSearchData redirectSearchData)