How to add a menu item that is just a redirect to other page on site?

Tim Valdez asked on June 26, 2024 23:42

Kentico 11 custom MVC site.

I am trying to figure out how to add a page to the website menu (checked the add to navigation box) but have that link in the menu go to a different page in the website hierarchy. I've played with the page alias for hours and can not get the link to go to the other page, it only always goes to the current (blank) page. What's the trick to doing this?

In the alias settings window I set it to "standard URL or wildcard" and then put in the root-relative directory where I want this page to go on our website, then selected "Use site settings (default)" for the Alias Redirection item. But all it ever does is still show the existing empty webpage.

Correct Answer

Brenden Kehren answered on July 2, 2024 17:13

If it's a custom MVC site I'm assuming those settings/properties won't work as you'd expect. I'd create a page type called Link. Add the properties; link name (system), link text, link URL. In your controller handle whether or not it's internal or external by checking the link URL property, then perform a local or external redirect. We use this on v13 sites without issue.

if (Url.IsLocalUrl(link.LinkURL))
{
    return LocalRedirect(link.LinkURL);
}
else
{
    return RedirectPermanent(link.LinkURL);
}
0 votesVote for this answer Unmark Correct answer

Recent Answers


Tim Valdez answered on July 2, 2024 17:39

Thank you for that. I haven't yet looked, but is there a way to specify that only certain Roles can access certain Page Types? If so, a hint where I can look would be appreciated.

0 votesVote for this answer Mark as a Correct answer

center3 consulting answered on July 4, 2024 11:53

To add a menu item that redirects to another page on your site, follow these steps. First, access your website's content management system (CMS) or theme settings where the menu is managed. Create a new menu item and enter the desired label for the item. In the URL or link field, input the full URL of the target page you want to redirect to. Ensure the target URL is correctly formatted, typically starting with "http://" or "https://". Save your changes and verify that the new menu item appears in the menu. When clicked, this menu item will redirect users to the specified page seamlessly.

0 votesVote for this answer Mark as a Correct answer

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