This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by arndH 2 months, 1 week ago.

Assigned support staff: Lauren.

Author Posts
July 30, 2019 at 2:57 pm #4308883

arndH

I am trying to:

There is an open support ticket with regards to the redirects which has not yet been resolved. I am still using the old workaround and therefore never updated the plugin since April.

However, I tried the following on the live site as well as on the test site with the latest version of WPML plugins.

I would like to reduce the number of languages I am using and therefore would like to redirect all /gb/ urls to /en/ urls.

Using regex works, kind of, but ^/gb/(.*)$ redirected to /en/$1 does the redirect to the German default language.

Also Usus redirects like en/category/events-en that should redirect to en/news redirects to the German /news/

When the end of the permalink is different, e.g. redirecting en/category-gb to en/category-en it works fine

Is there a way to include the language slug in the redirects generally?

Many thanks,

Andy

Link to a page where the issue can be seen:

I expected to see:

Instead, I got:

July 30, 2019 at 3:47 pm #4309459

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

To best troubleshoot the issue, please make a snapshot of your site using the Duplicator plugin: https://wordpress.org/plugins/duplicator/. This will allow me to try and duplicate the error so that I can run further tests without interrupting your live site.

Once the snapshot is complete, either upload the snapshot ZIP file and the installer.php file to a file sharing service such as Dropbox (and share the link in your reply) or right click the Duplicator links in your wp-admin and paste in your reply.

Please note: It is important to reduce the size of the package so please exclude some paths like /cache or /uploads and also exclude archives and media files.

I will also need the username and password of an account that was created BEFORE creating the duplicator package.

I will enable the next reply to be private so only you and I have access to it!

July 31, 2019 at 8:13 pm #4317527

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for allowing me additional time to troubleshoot. Here is what I found in my test site.

With WPML deactivated, this product page
hidden link
redirects to the default language:
hidden link

I then installed and activated the Disable URL Autocorrect Guessing plugin and as expected,
hidden link
now redirects to a 404 page.

I then updated all WPML plugins and activated WPML Yoast Multilingual addon. Activating or deactivating WPML did not seem to make any difference, I experienced the same results. So I think you need to look at your redirect rules, it seems something may be incorrect there.

August 1, 2019 at 10:26 am #4320555

arndH

Hi Lauren,

Thank you for looking into it and the testing. I did the same now with the following results:

Test URL: hidden link

Redirects with WPML active and Disable URL Autocorrect Guessing deactivated to

hidden link This is the German default Language

with WPML active and Disable URL Autocorrect Guessing active to

404 error page - Url in browser: hidden link domain/product/im-neuen-licht/ (the language slug is missing)

with WPML deactivated it redirects to the 404 page, but the URL in the browser is the correct URL hidden link

both with the Disable URL Autocorrect Guessing plugin activated or deactivated.

Testing a URL outside Woocommerce, e.g. hidden link delivers the following results:

WPML activated, Disable URL Autocorrect Guessing deactivated, redirects to

hidden link which is the German default language URL.

WPML activated, Disable URL Autocorrect Guessing activated, redirects to

404 Page, URL in Browser hidden link (The language slug is missing)

With WPML inactive, the redirects are 404 page, URL in Browser hidden link with Disable URL Autocorrect Guessing activated. This is the desired URL

and with URL Autocorrect Guessing deactivated
404 Page, URL in Browser hidden link (english language without language slug)

Therefore, I do believe the redirect rule is correct, I am using the most common Regex expression for domain changes: ^/gb/(.*) to /en/$1

Could you please look into this again?

Many thanks,

Andy

August 1, 2019 at 4:28 pm #4324179

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for the additional information. I set up a fresh install on a staging server so that we can both see the same results.

On this site, I installed Yoast Premium and Yoast Multilingual. Instead of using Yoast Redirects, I added the following line to the .htaccess page:

RewriteRule ^de(.*)$ es/$1 [R=302,NC,L]

Here, you can see that when I load
hidden link
it redirects to
hidden link

My full .htaccess looks like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^de(.*)$ es/$1 [R=302,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Feel free to check it out here:
One Click Login:hidden link
Username:demo
Password:0D2gGU99eZxf

Can you test this method on your live site and let me know if it resolves the issue for you?

August 2, 2019 at 8:18 am #4327953

arndH

My issue is resolved now. Thank you!