I’m wondering if there’s any way to control the redirect that happens when you visit the root of the site to the default website. For example: mydomain.com -> mydomain.com/sv.
The reason is we’re using multiple sites where some are not related, so you could say we have more than one default site. Since Litium 6 only seems to support one default site, we want to handle this redirection logic by ourselves.
A more detailed example of what we’re trying to do:
We have 4 sites:
If you go to mysite1.com, you should end up at mysite1.com/sv. But if you try to visit mysite2.com, you should end up at mysite2.com/sv.
Litium version: 6.1.1
For Litium 6 you need to create a separate website (set the website as default website) that will act as the landing page for the different domains and redirect the user to the correct page.
Where would be the correct place to intercept the URL and create the redirect? We have an authorization filter (implementing IAuthorizationFilter) which we use to force a logged in customer to the correct site. It also handles not logged in customers by determining which language site would be the correct site for the customer, based on IP and language settings.
However, Litium seems to intercept the call before IAuthorizationFilter.OnAuthorization gets called, so there is no way for us to see which URL that caused Litium to redirect to the default web site.
Litium uses an own registered
System.Web.Routing.RouteBase that handle the dynamic translation of the URL. The
RouteBase then return the correct handler depend on web forms of mvc that should handle the current request, if that is an mvc handler the normal mvc pipeline will be triggered with your filter.
If you need to intercept the url before we do anything with it, you need to do that by an own
RouteBase-route registered before Litiums route start processing the url.
Thanks. Initial tests show that the suggested approach works fine. It also means that I don’t need a special default site that just acts as a landing page, which is a bonus.