javascript - i18next multilanguage site with URL change -
i trying add multiple language support web-site, doesn't have .php files , doing i18next. urls need www.mysite/en/about/. decided make that
window.history.pushstate("", "", '/en' + window.location.pathname);
and on changing language:
$('.lang').on("change", function() { window.history.pushstate("", "", '/' + $(this).val() + window.location.pathname.substring(3)); i18next.changelanguage($(this).val(), function() { $('.page_text').localize(); $('.info').localize(); }); });
the problem when shares link www.mysite/fr/about/ gets error. can redirect www.mysite/about/ via .htaccess, how can language "/fr" parameter?
if know other ways around without using .htaccess, i'll glad hear them out.
thank help.
edit:
the error 404. routing folders .html files.
Comments
Post a Comment