Permanent redirects does not work?

Hi!

I cannot get the permanent redirects to work.
I have tried full url and relative url
https://www.mypage.com/product/test -> https://www.mypage.com/product/test_redirect
/product/test -> /product/test_redirect

None of the above works.
Do I need to restart the site or activate it in some other way?

Thanks!

/Kristoffer

Litium version: 6.3.9

Do you get an 404 or in what way doesn’t it work?

If there’s anything currently at the URL you want to redirect from, the redirect won’t trigger.

Ah, so that is the case? Yes, there is a working page there today so this it why it is not working I guess.
I tried a fake URL but that does not seem to work either.

https://www.mypage.com/product/fake_url -> https://www.mypage.com/product/test_redirect

Instead a get a 404.

Hmm, I don’t quite get how this should work.

/Kristoffer

Ah, the URL that I want to redirect from is a actually a category page, it does not exist in the CMS tree. Should that matter?

And I actually see and exception on the current page, but I guess the redirect should occur before the page is rendered?

Value cannot be null.
Parameter name: key

System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Concurrent.ConcurrentDictionary2.TryGetValue(TKey key, TValue& value) at Litium.FieldFramework.FieldDataContainer.TryGetValue(String culture, String id, Object& value) at Litium.FieldFramework.FieldContainer.GetValue[T](String id) at Litium.Foundation.Modules.Products.WebControls.CategoryMenu.RenderChildren(List1 productGroups, Dictionary`2 productGroupTable, HtmlTextWriter writer, Int32 level)
at Litium.Foundation.Modules.Products.WebControls.CategoryMenu.RenderContents(HtmlTextWriter writer)

Yes, if there’s any content (page, category, product) at the URL the redirect won’t trigger. The URLs should be entered relative (/test -> /redirect).

I believe any URL history redirects are executed before, so if you’ve changed the URL of an entity (say from test to test2) that could get in the way of your redirect.

Not sure what you error is or where it comes from.

Ok. But since I have several different sites I think I need the full URL.

For example:
http://www.mypage.se/outlet/outlet-30 -> http://www.mypage.se/jag-letar-efter/outlet
http://www.mypage.com/outlet/outlet-30 -> http://www.mypage.se/im-looking-for/outlet

I cannot get that to work, but this work, should it work?

Sorry, seems I wasn’t correct. You can add with domain, but without the protocol. The URL you redirect to can also include domain, but then also the protocol, or relative.

So litium.localtest.me/test can go to https://litium.localtest.me/redirect or just /redirect

That works just fine, thanks. Then I know how to do it and also that the content cannot exist. Thanks!

1 Like

Nils, there is no bulit in way to redirect an existing working page? It is quite easy to built something but not necessary to do if something exists.
Thanks!

/Kristoffer

There’s no built in way, you’d have to replace or decorate the resolver so that it checks redirects before the actual page.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.