Please make sure to update to WPML 4.3.6 and check our list of Known Issues before reporting

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.

This topic contains 12 replies, has 3 voices.

Last updated by arndH 11 months ago.

Assigned support staff: Bruno.

Author Posts
February 23, 2019 at 11:22 am

arndH

I am trying to: set up the Yoast SEO redirects

Link to a page where the issue can be seen: arnoldsche.com

I expected to see:
Hi there, I have plenty of redirects that do not work when redirecting to a WPML page. The error message I am getting is:
You're redirecting to a target that returns a 301 HTTP code (permanently moved). Make sure the target you specify is directly reachable.
I have set the memory limit as suggest in one of the threads and also deactivated and reactivated WPML with no success.
Any idea what to do please?

Instead, I got:

February 25, 2019 at 6:16 pm #3241566

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thank you for contacting us. Please, my sincere apologies for the delay in answering.

Please, could you tell me the step by step that I have to follow to see the problem you are reporting? Also, what pages are you seeing with redirect issue?

Can you please elaborate a little more so I can better understand? Sometimes screenshots illustrating what you mean may go a long way to clarify what words fail to transmit so if you like make use of "upload an image" below the comment area.

Thank you.

February 26, 2019 at 5:52 pm #3246600

arndH

Hi Bruno,

Thank you for your response. I have attached a screenshot with the issue.

I added a redirect previously, but still get a crawl error and the redirect does not work. There is of course no redirect for the target url. If I want to amend the redirect, I am getting the message shown on the screenshot. This does happen only for the translated languages.

Normally, when I confirm the redirect by pressing save, it does the redirect though.

Kind regards,

Arnd

February 26, 2019 at 5:58 pm #3246619

arndH

I just would like to add the following

/en/linda-macneil-2/ is redirected to /en/product/linda-macneil/

I am getting the same error message as on the previous screenshot but, even though I reserved the redirect, it does not work

February 26, 2019 at 7:13 pm #3246944

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi Arnd,

I was able to replicate the problem you're talking about. To ensure that this plugin is made compatible with WPML we need to contact the plugin author and work with him on resolving the issue.

I have forwarded the details to our Themes & Plugins Compatibility Team and they will contact the author. Our Compatibility Team will work with the author of the plugin for this to work properly.

Please note that this process may take a while as it depends on how soon the author will reply to our efforts to contact him.

Thank you.

February 27, 2019 at 10:13 pm #3252630

arndH

Thanks Bruno and I look forward to hearing from you again.

February 27, 2019 at 11:10 pm #3252702

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Sure. Sorry for the delay. As soon as I have a response from our compatibility team I will keep you informed.

Thank you.

March 1, 2019 at 1:52 pm #3261225

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Our compatibility team suggested this workaround to fix the problem:

Add this code to wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/class-wpml-home-url-filter-context.php after line 50:

    private function seo_target() {
        return $this->debug_backtrace->is_class_function_in_call_stack( 'WPSEO_Redirect_Accessible_Validation', 'parse_target' );
    }

and at line 36 change this:

			|| $this->pagination_link();

to:

			|| $this->pagination_link() || $this->seo_target();

This compatibility issue has already been forwarded to our developers. I do not have a deadline, however, when this is going to be released.

Thank you.

March 3, 2019 at 8:25 am #3265778

arndH

Hello,

Thank you for the response. I added the code, but unfortunately, it is still not working.

I realised that it is now the trailing slash causing the problem.

If I have a redirect in the main language for e.g. "Sammlerliteratur" it is redirecting both
/sammlerliteratur/
and /sammlerliteratur
to/produkt-kategorie/sammlerliteratur/

In an translated language, the redirects work without the trailing slash but not with it (like the urls are on Google.

In the previous example

/en/linda-macneil-2 reedirects correctly
/en/linda-macneil-2/ is causing a 404 error

Same is with

/en/Collectibles/ is causing a 404n error
/en/Collectible is redirecting to /en/product-category/collectibles-en/

Could you help with this please?

Many thanks,

Arnd

March 4, 2019 at 9:11 pm #3270661

arndH

My issue is resolved now. Thank you!

March 13, 2019 at 3:31 pm #3335759

suska

Can you please let us know what you did to fix the issue???

March 13, 2019 at 9:59 pm #3338511

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

The recommended steps as a workaround: https://wpml.org/forums/topic/redirecting-target-not-directly-reachable/#post-3261225

If the problem persists, please open a new topic and one of our supporters will check this.

Thank you.

March 26, 2019 at 9:05 pm #3466435

arndH

Hi Suska,

Just to update the solution that worked. Combined the above solution with

Change:

1
if ( $redirection['origin'] === $url || '/' . $redirection['origin'] === $url ){
to

1
if ( $redirection['origin'] === $url || '/' . $redirection['origin'] === $url || $redirection['origin'] . '/' === $url || '/' . $redirection['origin'] . '/' === $url ){
within the file and on line 15:

/sitepress-multilingual-cms/classes/compatibility/wpseo/class-wpml-wpseo-redirection.php

what was suggested in another thread.

After that, everything worked very well.