Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 4.6.9

Resolved in: WPML 4.6.10

Topic Tags: Bug

Overview of the issue

In a multisite WordPress network or a single install with a sub-folder installation, activating the Use directory for default language option leads to incorrect redirection for taxonomy archives, resulting in a 404 error.

Workaround

Please, make sure of having a full backup of your site before proceeding.

You can try to install the latest beta release for WPML (v 4.6.10)

Or try the following:

  • Open …/wp-content/plugins/sitepress-multilingual-cms/classes/canonicals/class-wpml-canonicals-hooks.php file.
  • Look for line 104.
  • Change:
    				$currentUri = substr( $currentUri, strlen( $path ) );
    
  • For:
    				$currentUri = '/' . ltrim(substr( $currentUri, strlen( $path ) ), '/');
    
    

9 Responses to “WPML - Redirection Issue when Sub-Folder Installation is enabled”

    • Thank you very much for your feedback. Our developers are aware of this issue and working in a future release with a fix for it.
      Regards

  1. Sorry, I’m not a developer – I’m just messing around with code …

    I found, that in /wp-content/plugins/sitepress-multilingual-cms/classes/canonicals/class-wpml-canonicals-hooks.php

    In line 108 it checks if there is ‘/’.$lang in $currentUri
    if not in line 110 it adds up to $home_url . ‘/’ . $lang . $currentUri

    In my case $currentUri was set to ‘en/category/x/’ —> $lang is already there, only the slash is missing.
    now it adds up $home_url .’/’ . ‘en’ . ‘en/category/x/’

    This seems to be the reason for my problem.

    Could please you have a look into this?

  2. I have to correct my former statements: your patch did work!

    My redirect seems to have other reasons- it was not related to WPML.

    Thanks for the patch and sorry for my former confusing messages.