I'm currently working on a website that represent multiple websites. For exemple: www.mychatsite.com and www.mijnberichtensite.nl. We have created a custom viewengine to use different views for both websites while we can re-use the website engine.
Because the first website is english and the second website is dutch we also needed to do some kind of URL rewriting. So in the RegisterRoutes (in global.asax) I added some routes to do my url customization. When you goto "www.mijnberichtensite.nl/aanmelden" you'll actually request the controller "signup/index".
routes.MapRoute(
"aanmelden",
"/aanmelden",
new { controller = "signup", action = "index" }
);
This all works well, but now there are some problems:
1. When you are on the Dutch website and you request the English url, it will work as well. (which would be a nice to have if we could solve this)
2. MVC's UrlHelper is mixing the urls, when you do BeginForm("index", "signup"), you will be redirected to the url: "/aanmelden" because it is first in the routing table prior to the original routing. This is good behaviour for the dutch website, but not for the english website.
While I was searching for the solution online I found alot of different takes on this problem, but nobody wants to use totally different urls (only rewriting like: /nl/signup/index). So I couldn't find an example of the correct take on this problem.
What would be the best way to solve this?
Best regards,
Willem