Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -
- 19:00 – 22:00 19:00 – 22:00 19:00 – 22:00 19:00 – 22:00 19:00 – 22:00 -

Supporter timezone: Asia/Kathmandu (GMT+05:45)

This topic contains 6 replies, has 2 voices.

Last updated by Subash Chandra Poudel 1 year, 8 months ago.

Assisted by: Subash Chandra Poudel.

Author Posts
August 13, 2022 at 1:14 pm #11860829

oldrichH

I am trying to: Have a web without crawl errors

Link to a page where the issue can be seen:
hidden link
Password for this report page is "debug".
Invalid links are striked out.

I expected to see:
No bad links.

Instead, I got:
All broken links reported by Google Search console has a number suffix in the post_name and type of the post is the attavhment only.

Somewhat paradoxically, not all reported links actually work. Some do work, and I can see from the GSC chart that the number varies from time to time. I don't understand what this could be.
I have verified that all the images in question are in the database, however, they need to be queried using the permalink structure set up, see list number two below.
When the permalink is visited, it redirects to a URL without a suffix. I don't fully understand why this happens and why the browser doesn't stay at the address according to the permalinks settings. All the links below are valid.

You're probably now asking why I'm posting this on the WPML forum. At first I didn't connect this problem to WPML, but after looking at the database I think it might be related to duplicating images for translation, see the table at the end of my summary. In it, focus on the image_title and image_name columns. Is it permissible for there to be multiple different post_name for a single post_title?

If you evaluate the table as valid, then I will look elsewhere and you don't need to pursue this further.

There may also be a problem with the .htaccess file settings.

Options +FollowSymLinks
RewriteEngine on

<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>

# Redirect HTTP with www to HTTPS with www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* hidden link{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTP without www to HTTPS with www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* hidden link{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTPS without www to HTTPS with www
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* hidden link{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Image 2022 08 13 001.png
August 16, 2022 at 11:09 am #11871949

Subash Chandra Poudel

Hi there,

Thank you for contacting WPML Support and sorry for the delayed response due to the weekends.

Let's take reference to the first broken URL hidden link

This URL does not seem to be coming from WPML but looks like is somehow related to WPML as I see the translations of the media link hidden link also has -2 at their end of the slug.

But as you can see in the links below all the WPML translation URLs are working fine

hidden link

hidden link

hidden link

hidden link

hidden link

The issue does not looks related directly to WPML. But the question here is how and where WPML finds these URLs and tries to crawl them causing the error.

Do you have information on which page or post is linking to those URLs with errors or where Google is finding those URLs? That could help you find the cause of the issue and troubleshoot it further.

Regards,
Subash

August 23, 2022 at 10:55 am #11911523

oldrichH

Hei Subash,
thanks for the answer, what struck me was that according to the SQL table quote there is an attachment with ID 5631, which is Czech and then another one in Czech with ID 14974. This made me think that WPML duplicates the media for the original language and also that WPML is responsible for the -2 and -3 suffixes.

If this can be explained as a feature and not as a bug, then of course I'll keep looking elsewhere.

I can probably solve the problem with the Redirecton plugin, but certainly not the cause.

August 23, 2022 at 12:44 pm #11912309

oldrichH

PS: GSC found the links at pages. I have read now about WPML Sticky links, it should just worry about the wrong links, so why isn't he doing it?
The Redirection plugin works similarly to Sticky links, so I hope they can be used simultaneously... It's strange that the links to the attachment pages start working after some interval, as you mentioned, some links that were reported as broken are already working now without any intervention.

August 23, 2022 at 1:29 pm #11912811

Subash Chandra Poudel

Hi there,

Yes WPML duplicates images in different languages if you have Duplicate options enabled at WPML -> Settings -> Media Translation page. Also, the -2 , -3 are appended to Media URLs by WPML based on the slug translation or availability of the media page.

However, the broken links for example hidden link does not seem to be the correct URL from WPML, the correct URL instead is hidden link as I explained in the previous reply.

If you could let me know more details in which page exactly GSC found the link for example where GSC found the link to the page hidden link I can check what is linking to this non-existing URL in the page and try to find the issue and determine if the issue is due to WPML or not.

> I have read now about WPML Sticky links, it should just worry about the wrong links, so why isn't he doing it?

WPML Sticky links do not automatically fix all 404 or nonexisting page links. It instead updates the Links in the contents on your site if somehow the changes you made in WPML change the links or URL of pages on the site.

> The Redirection plugin works similarly to Sticky links, so I hope they can be used simultaneously.

Yes, the Redirection plugin is compatible with WPML ( https://wpml.org/plugin/redirection/ ) and can be used in combination of WPML plugins.

Regards,
Subash

August 24, 2022 at 12:41 pm #11921925

oldrichH

I had the same idea, GSC don't show this information, but I have found them in sitemap.xml (attachment-sitemap15.xml) and in the database. I still don't know, why Czech version of image with meta is in database doubled, this is the core idea I mean...

August 24, 2022 at 4:02 pm #11924037

Subash Chandra Poudel

Hi there,

Thank you for more information on the issue. Yes, I see the broken links in the sitemap attachment-sitemap15.xml too. So the issue seems to be related to the wrong URLs in the sitemap.

Regarding the entries ID 5631 and 14974 in the database, it is normal and we cannot confirm if the entries are made by WPML so the issue could be anything until we test to confirm it is WPML.

To troubleshoot it further can you please:

1. Back up the site completely to prevent any issues. Or better if you can test it on a staging site.

2. Regenerate your sitemap with your SEO or sitemap plugin and see if it helps fix the issue.

3. If not, deactivate all Plugins except WPML plugins, the plugin generating sitemap, and activate a default theme like twenty-twenty-one and regenerate the sitemap to see if the issue still persists or not.

4. If the issue does not persists activate the plugins and theme one at a time and regenerate the sitemap to see which one starts the issue.

5. If the issue persists, please Duplicator plugin ( https://wordpress.org/plugins/duplicator/ ) to generate a backup/package of your site and provide me with the site package so that I can check the issue further.

I have enabled private replies for you to share the package link safely. You can download the duplicator package and installer and then upload it to file storage platforms like Google Drive and share the link.

Regards,
Subash

The topic ‘[Closed] Broken image media attachment post links with number suffix -2 or -3’ is closed to new replies.