Getting Full URL From Alias URL

Joseph Pike asked on November 9, 2021 21:55

One of my sites is having an issue with Alias URLs not redirecting to the actual page... this becomes an issue when a user creates a page with >50 characters as an alias url is automatically generated, and links to that alias url will 404. Is there a good way to go about getting the full page URL from the alias url using the DocumentQuery api? I think if I can figure that part out I can redirect to the correct URL

Correct Answer

Joseph Pike answered on November 12, 2021 15:14

Solved this by reading documentation haha --

var thePage = new DocumentQuery().WithPageUrlPaths()
                    .WhereEquals("NodeAliasPath", aliasURL).FirstOrDefault();
DocumentURLProvider.GetUrl(thePage);
0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.