Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Trailing slash in 1000s of URLs: 301 or canonical

https://example.com/product/acme-2/

         

guarriman3

4:27 pm on Jan 5, 2024 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi,

For some weird reason I'm not able to understand (some typo in old internal linking?), within the "Page with redirect" section of Google Search Console, I've got thousands of URLs like this one:
https://example.com/product/acme-2/

The preferred URL is
https://example.com/product/acme-2 (with no trailing slash)

Within the PHP code of the product pages, I catch the trailing slash (if exists) and I 301 redirect to the preferred URL (with no trailing slash)

I do not want to overload Googlebot with these thousands of URLs, and I wondered if it's worth catching the trailing slash and generating more redirects in GSC, or it's worth using a canonical metatag

<link rel="canonical" href="https://example.com/product/acme-2" />


Thank you.

not2easy

5:01 pm on Jan 5, 2024 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If you visit "https://example.com/product/acme-2/" what happens? I mean, is it a Google error or a real thing? That should help you decide how to handle it. GSC can report lots of things that don't exist so investigate and find out if it is a real problem or another Gglitch.

tangor

7:30 am on Jan 6, 2024 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Check your logs ... are the pages being served properly?

lucy24

6:33 pm on Jan 6, 2024 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you're successfully redirecting the incorrect URL, you're doing what you need to do. But you might want to give your site code a once-over to ensure that you're not accidentally linking to the without-slash form.

Years ago, I goofed on some php-generated pages, resulting in links in the form /directory//subdir/pagename. G*** has recently rediscovered these bad URLs in some back drawer, and is requesting them like mad. There is a redirect in place, and nothing currently links to the wrong form, so all I can do is wait them out.

Finally, some law-abiding robots like to request without-slash forms of URLs that do end in slash. (In my case they are real physical directories, so mod_dir takes care of it.) Whatever makes them happy...

guarriman3

2:48 pm on Jan 8, 2024 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thank you @not2easy, @tangor, @lucy24 for your nice answers.

If you visit "https://example.com/product/acme-2/" what happens?

- If I visit with my browser, I see that I'm redirected to 'https://example.com/product/acme-2', with regular contents
- If I use an online redirect checker, I see one 301 redirect, and then a 200 response

Check your logs ... are the pages being served properly?

I think they are:
35.235.81.103 - - [02/Jan/2024:00:04:39 -0500] "GET /product/acme-2/ HTTP/1.1" 301 5832 "http://www.google.com" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/78.0.3904.108 Chrome/78.0.3904.108 Safari/537.36"
35.235.81.103 - - [02/Jan/2024:00:04:39 -0500] "GET /product/acme-2 HTTP/1.1" 200 20855 "http://www.google.com" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/78.0.3904.108 Chrome/78.0.3904.108 Safari/537.36"


G*** has recently rediscovered these bad URLs in some back drawer, and is requesting them like mad. There is a redirect in place, and nothing currently links to the wrong form, so all I can do is wait them out.

Yes, I suspect that, at some point, I included wrong URLs into my links. And now, G* remembers them and has been crawling them for years.

If it's useful, I've been checking the 'Inspection URL' tool of GSC to analyze the Referring Pages, just to find if there is any external linking source. However, I see always the same sources:
https://example.com/product/acme-2 (the same canonical URL, why is it a Referring Page?)
https://amp.example.com/product/acme-2 (an old AMP subdomain that I 301-redirect to the new properly-written URL)


My fear is that so much redirection is hurting my crawling budget and my SEO ranking, although things are probably going well and Googlebot (and I) are just doing well our job.