My current Sitecore(9.0.2)
project have multisite implementation with URL structure as follows
- Url: www.MainSite.com virtual folder:/
- Url: www.MainSite.com/SubSite virtual folder:/SubSite
- Url: www.MainSite.com/SubSite/Site1 virtual folder:/SubSite/Site1
- Url: www.MainSite.com/SubSite/Site2 virtual folder:/SubSite/Site2
We have to use a common Sitecore component for SubSite, Site1, and Site2. the component has Ajax form posting and for this, I have added a single route entry for each of the APIs as follows:
routes.MapRoute(
name: "routeName",
url: "{virtualFolder}/api/ContrrolerName/ActionName",
defaults: new { controller = "Test", action = "action", id = UrlParameter.Optional });
The above routing is perfectly working for SubSite and when used on Site1 it is returning a 404 error during Ajax post. However, it is working correctly when I removed SubSite from URL ie, www.MainSite.com/Site1.
So I understand that {virtualFolder} is not returning the path defined on siteconfig file. It is returning only the last part.
Anybody help me to resolve this issue