-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirects not working 100% #71
Comments
Hi @jonroberts24, If I understand you correctly, the vanity page still exists? The basis of the redirects module is that it only kicks in if nothing at the requested URL exists in Umbraco. So if a page in Umbraco already exists, the redirect will not work. I hope that answers your question ;) |
Hi |
@jonroberts24 yes, something like that. But the redirects are not limited to "short URLs" - you can make long URLs like To explain things a bit further, the redirects package works with inbound redirects and outbound redirects. Inbound redirects are the ones listed in the global dashboard, and you can also add a property editor at the page level to show inbound redirects. Inbound redirects will only work if nothing exists at the specified URL. This is partially because of performance reasons, as it isn't ideal to hit the database on each request. There is an existing issue for the purpose of introducing forced redirects. The though is that this will work even if a page exists in Umbraco with the same URL. But this is not something I'm actively working on. Outbound redirects are then instead a redirect from an existing page to somewhere else. The package contains a property editor for this as well: The property editor is only for saving the outbound redirect - there is no logic in the package responsible for redirecting the user from the page with the outbound redirect to it's destination. This should generally be handled somewhere inside the Umbraco request pipeline, but people are likely to handle this very different, which is why the package doesn't handle it for you (for instance, we use Umbraco as a headless CMS, so handling this in the Umbraco request pipeline wouldn't work for us). |
Thank you so much for all your help. |
When we did Umbraco MVC sites, we'd handle it in the MVC controller (this was in Umbraco 7 though, so the classes are named a bit differently): using System;
using System.Web.Mvc;
using System.Web.Security;
using Umbraco.Web.Mvc;
using Skybrud.LinkPicker;
using Skybrud.LinkPicker.Extensions;
using Umbraco.Web;
namespace Client.Controllers.Mvc
{
public class ClientMasterController : RenderMvcController
{
protected ViewResult View(Master model)
{
return View(null, model);
}
protected ViewResult View(string view, Master model)
{
try
{
LinkPickerItem skyRedirect = model.Content.GetLinkPickerItem("skyRedirect");
if (skyRedirect != null && skyRedirect.IsValid)
{
Response.Redirect(skyRedirect.Url);
return null;
}
}
catch (Exception ex)
{
}
}
}
} The controllers for each content type would then inherit from this controller, and they would thereby inherit the redirect check. With ModelsBuilder these controllers doesn't make that much sense anymore, so I'm not sure what will be the best location to add that check these days. |
When I create a "vanity" redirect, for example /mypage - and redirect it somewhere on the site it works perfectly well.
If I create a redirect from an existing page on the site to redirect somewhere else on the site it doesn't work.
We are using Umbraco 8.6.4 with the latest version of the Skybrud Redirects.
Any ideas?
Thanks Jon
The text was updated successfully, but these errors were encountered: