Jump to content

remove default language from folder?


Recommended Posts

Hi -I just saw a similar, old post and have the same issue...

 

Although i know the benefits of each language being in a /en /fr etc folder, I don't think it's a great idea to move your default language for an established site (for SEO reasons having read disaster stories) from the root folder to /en.

 

For me, (and looking on these forums, other people too) it would be great if the default language would stay in the root folder when other languages are enabled.

 

I don't mind so much that the additional languages are put in folders, but I really need to figure out some way that the root folder will not change, so that english (default language in my case) does not go into a folder. Although nobody seems to have figured this out, I imagine the solution is pretty simple.

 

At the moment my site is now short of 2 languages that I'd set up so disabling those has obvious drawbacks (and drawbacks for SEO as well).

 

Update: I found this post that has a 'solution' that appears to be on the right track but isn't reliable in 1.5 in my experience but definitely seems to be almost working http://www.prestashop.com/forums/topic/236630-remove-language-extensions-through-htaccess/

 

thanks

Edited by Andrew H (see edit history)
Link to comment
Share on other sites

  • 1 year later...

I think that it cant be done from htacces in mdole called block leanguges it must be writen exception in index.php file

This is code for redirection

 

$languages = Language::getLanguages(true, $this->context->shop->id);
        if (!count($languages))
            return false;
        $link = new Link();

        if ((int)Configuration::get('PS_REWRITING_SETTINGS'))
        {
            $default_rewrite = array();
            if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int)Tools::getValue('id_product')))
            {
                $rewrite_infos = Product::getUrlRewriteInformations((int)$id_product);
                foreach ($rewrite_infos as $infos)
                    $default_rewrite[$infos['id_lang']] = $link->getProductLink((int)$id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int)$infos['id_lang']);
            }

            if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int)Tools::getValue('id_category')))
            {
                $rewrite_infos = Category::getUrlRewriteInformations((int)$id_category);
                foreach ($rewrite_infos as $infos)
                    $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int)$id_category, $infos['link_rewrite'], $infos['id_lang']);
            }

            if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int)Tools::getValue('id_cms')) || ($id_cms_category = (int)Tools::getValue('id_cms_category'))))
            {
                $rewrite_infos = (isset($id_cms) && !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
                foreach ($rewrite_infos as $infos)
                {
                    $arr_link = (isset($id_cms) && !isset($id_cms_category)) ?
                        $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) :
                        $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                    $default_rewrite[$infos['id_lang']] = $arr_link;
                }
            }
            $this->smarty->assign('lang_rewrite_urls', $default_rewrite);
        }
        return true;
    }

Link to comment
Share on other sites

  • 2 years later...

see addon's there are 'friendly friendly url' modules that allow you to suppress language for default language, additional languages would still have language code.  Note these are not folders just symbolic rep of working language.

so when a client wants to add their first additional language, we use module to suppress original default lang,  so url does not change....

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...