How to replace language UniqueSeoCode from url

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
How to replace language UniqueSeoCode from url.

I need to manage language UniqueSeoCode from plugin. how to replace from plugin. if user selection any language from website but i need to redirect to only one language then how to do this ?


I try to do this from action filter based on CommonController of public website and then from this action filter i redirect to specific url. is this proper way or if you have any another proper way let me suggest please.


I need to redirect to customer to spefic language when customer directly open website(e.g. www.google.com) at the time in url does not contain any language so at this time i need to use my specif language.
now how to check that url contain language seocode or not.

if i use actionfilter on commonController at that time i always get language code? how to manage ?
7 years ago
rasel wrote:
Here is my solution to my own problem, may be someone else needs it also:

just add this code to global.asax.cs file


protected void Session_Start(object sender, EventArgs e)
        {
            var _workContext = EngineContext.Current.Resolve<IWorkContext>();
            var _webHelper = EngineContext.Current.Resolve<IWebHelper>();
            var _languageService = EngineContext.Current.Resolve<ILanguageService>();

            Nop.Services.Directory.GeoCountryLookup geo = new Nop.Services.Directory.GeoCountryLookup(_webHelper);
            string country = geo.LookupCountryCode(Request.ServerVariables["REMOTE_ADDR"]);
            if (country.Equals("TR"))
            {
                var language = _languageService.GetLanguageById(0);
                _workContext.WorkingLanguage = language;
            }
            else
            {
                var language = _languageService.GetLanguageById(1);
                _workContext.WorkingLanguage = language;
            }
        }




I need to do this through plugin. I dont want to change anything into nopCommerce code. so how can i do this?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.