Jump to content

Language url selector active by default


Recommended Posts

Good Morning,
I have an answer and I hope that someone more expert can help me.

I'm going to publish a website in prestashop.
The website will be in two languages (italian and english).
By now we have only the italian contents, so I will start to go online only in italian and then add english.

The problem is in the url:
If I deactivate the second language all urls become www.mysite.it/PAGENAME. When I activate the second language, obviously it appears as www.mysite.it/it/PAGENAME and his translation go to www.mysite.it/en/PAGENAME.

This fact will be a problem for seo and internal manual links.

Does exists a way to "force" prestashop to use the "it" language url selector even if only one language is active?

Can anyone help me?

Link to comment
Share on other sites

Maybe easier method:

 

1) Disable the English site

 

2) Edit file classes/Language.php

 

Almost at the end, you have a function that checks if there are more languages. This function is elsewhere used when checking if /<language code> should be added.:

 

/**
* Check if more on than one language is activated
*
* @since 1.5.0
* @return bool
*/
public static function isMultiLanguageActivated($id_shop = null)
{
    return (Language::countActiveLanguages($id_shop) > 1);
}
 
change 1 into 0:
 
    return (Language::countActiveLanguages($id_shop) > 0);
 
 
Then reload the front page (use only domain www.mysite.it/ and it will automatically add /it/
 
 
Hope this helps,
pascal
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...