People, I am in developing an asp.net website with a Multilanguage content and SEO is a very high priority.
I have managed to get my website to display different URLs through asp.net URL routing to display site.com/ar and site.com/en depending on the selected language and this works fine on .apsx page on the root directory. However, this does not work in pages in subdirectories for example site.com/en/Account/Login.aspx and I have spent days trying to make my URL routing to work with my subdirectories but I was not able to get it to work with subdirectories.
So, from the-easy-way point of view is it better to have different physical directories /ar and /en on my root directory with different content pages for each language. This is also preferred since the layout for /ar page are completely flipped horizontally because ar = Arabic = right to left language.
Please do share your opinions on the advantages disadvantages of this approach.
The URL based approach should work correctly even on subdirectories. Because you mention “subdirectories” rather than “controllers/actions” I assume you have your application implemented with ASP.NET WebForms rather than the MVC.
If this is so, you url rewrite your requests in your
Application_BeginRequest:With such approach, you have your physical structure in the filesystem and requests of the form
en\Subdir1\Subdir2\resource.aspxare correctly routed toSubdir1\Subdir2\resource.aspx.Although the example shows manual rewriting, you can use any existing rewriting technology if it fits your needs.
This is just to get you started. However, if you have any specific issues in your implementation of the url rewriting, I assume you’d have to ask other specific questions so that people can help you out with specific problems. If you just say I’ve spent days and it does not work then it is impossible to help you with your specific approach.