Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Wrong URL when switching language

Status Resolved
Add-on / Version Publisher 2.3.1
Severity
EE Version 3.5.3

2op

Mar 09, 2017

Let’s say I’m on a page whose URL is http://localhost/teste/index.php/pt/diretoria (in Portuguese - our default language). If I try to switch language to English the URL created by the plugin is http://localhost/teste/index.php/en/teste/index.php/pt/diretoria. I couldn’t find out why this is happening.

I’m using the following code to generate the language switcher:

{exp:publisher:languages}
    <li><a href="{switch_language_url}">{long_name}</a></li>
{/exp:publisher:languages}
#1

BoldMinded (Brian)

Is directoria a template name or a Structure/Pages page?

Did you try {translated_url}?

#2

2op

I’m so sorry, that’s it: {translated_url} instead of {switch_language_url} 😊

#3

BoldMinded (Brian)

{switch_language_url} should still work. What is your $config[‘site_url’] value set to? It looks like its an issue with having the site in a folder instead of at the root of the domain. This could still be a bug. Does {switch_language_url} work if the site is at the root of the domain?

#4

2op

I didn’t have the chance to test in production yet, so yes it is in a subfolder called teste in my localhost. Our base url is http://192.168.1.174/teste/

#5

2op

Sorry, http://localhost/teste/

#6

BoldMinded (Brian)

Could you move it to a non-sub folder location locally just to test to see if the translation variables work then?

#7

2op

I’ve tried that and the problem still occurs. If I’m on a page whose URL is http://localhost/index.php/pt/diretoria and I try to switch the language to English, the new URL is http://localhost/index.php/en/index.php/pt/diretoria.

The problem only happens if I’m using {switch_language_url} though, with {translated_url} it works just fine.

#8

BoldMinded (Brian)

What do you have set for these values in the CP?

https://www.dropbox.com/s/x8qz1jah7icwwew/Screenshot 2017-03-14 06.52.00.png?dl=0

#9

2op

Default base URL: http://localhost/teste/ Default base path: /Users/ana/Sites/teste/ Website index page: I try to set this index.php but the system keeps erasing the value, so I included this in config.php: $config[‘site_index’] = ‘index.php’;

#10

BoldMinded (Brian)

Have you tried not using index.php and setting up a rewrite rule to remove it? Then the config[‘site_index’] setting would be left to blank. If it works with using the rewrite rule and removing index.php, then it gives me some guidance on where to look into fixing the issue.

#11

BoldMinded (Brian)

Closing due to lack of inactivity/response. If this is still an issue feel free to re-open the ticket.

Login to reply