Allow non-search-engine-friendly links
-
Hello Marco,
I’m currently having a problem with an unexplainable redirect loop on several of my translated pages. Ofer is currently at a loss as to what is causing them. I’m using your plugin to switch languages and, as you say in the documentation, it requires that the search-engine-friendly link rewriting setting be activated in Transposh for your selector flags to create a correct URL.
When I turn off search-engine-friendly link rewrites, the problem pages display correctly.
While I would like Ofer to find the solution, until he does, it might be nice if this piece of code in your plugin could be modified to allow “ugly URLs” for translated pages with query parameters instead of /en/ format URLs. Any possibility of that?
Thanks!
public function get_target_page($lang)
{
$site_url = get_site_url();
$current_page = parse_url($_SERVER['REQUEST_URI']);
if ($this->options['redirect_to_home'] === 'on') {
$target = $site_url . '/' . $lang;
if ($this->default_lang === $lang) {
$target = $site_url;
}
} else {
if ($this->get_current_lang() === $this->default_lang) {
$slug = $current_page['path'];
} else {
$slug = substr($current_page['path'], 3);
}
if ($this->default_lang !== $lang) {
$target = $site_url . '/' . $lang . $slug;
} else {
$target = $site_url . $slug;
}
}
- The topic ‘Allow non-search-engine-friendly links’ is closed to new replies.