Google Search Console was somehow detecting and listing partial URLs on my WordPress site (which redirected to the full URLs). This article explains how I investigated and fixed this SEO issue.
Here's an unusual SEO issue I spotted in Google Search Console: Google was detecting (but not indexing) some partial URLs on my site. For example, if the page URL was https://www.technicallyproduct.co.uk/analytics/renaming-fields-in-google-data-studio-useful-but-confusing/, Search Console was indexing this page but also detecting https://www.technicallyproduct.co.uk/analytics/renaming-fields-in-google-dat (a partial or truncated URL):
These partial URLs were showing up in Search Console under Indexing > Pages as 'Page with Redirect'. It looked like there was one listed for every published (and indexed) post on the site:
And the partial URLs were indeed redirecting, because of a WordPress feature that seems to have lots of different names:
What does this feature do? By default, if you enter a partial URL, WordPress will 301 (permanent) redirect you to the full URL. I suppose this could be useful if URLs get truncated accidentally, or if someone pastes in just the first part of a URL to their browser address bar.
I gave it a quick search, and came across a WordPress support thread where two other users were having a similar problem. The suggestion here was to disable WordPress's redirect guessing.
I didn't want to do this, because it would presumably replace all those 301 permanent redirects with 404 'page not found' responses. And I wasn't sure that would be any better, either from an SEO perspective or a user experience one (if users were somehow using those partial URLs).
Instead I wanted to work out where Google was picking those partial URLs up from. In Search Console, I clicked on that first partial URL and chose 'INSPECT URL'. This told me that the referring page was the published blog post. In other words, Google was detecting https://www.technicallyproduct.co.uk/analytics/renaming-fields-in-google-dat on the page https://www.technicallyproduct.co.uk/analytics/renaming-fields-in-google-data-studio-useful-but-confusing/.
So I went to that page and chose to 'View Page Source' (Ctr + U). Searching the source, I couldn't find the partial URL https://www.technicallyproduct.co.uk/analytics/renaming-fields-in-google-dat anywhere on the page.
Back in Search Console, I examined the partial URLs again. This time I noticed they were all the same length: exactly 76 characters. Or looking at it another way, the page path (the bit after the domain name) was exactly 40 characters. This rang a massive bell...
A couple of years ago, I'd set up some targeting in Google Ad Manager to allow me to target (serve) ads to a particular page on the site. This involved passing the URL of each page to Google Ad Manager in a key-value. However, Google Ad Manager has a limit of 40 characters per value, so I was truncating each value to the first 40 characters of the page path. Here's how it looks in the page source:
(As well as URL, I'm also passing post ID, category name, and category ID - allowing me to target ads based on any of these keys.)
The reason I hadn't found it when I was searching the page source was because I was looking for https://www.technicallyproduct.co.uk/analytics/renaming-fields-in-google-dat (including the domain name) but the value was /analytics/renaming-fields-in-google-dat (just the page path). Effectively a relative URL (Link). Doh!
To fix this issue, I tweaked the value I was sending to Google Ad Manager so it no longer included the initial forward slash. In other words, my targeting value for that post changed from /analytics/renaming-fields-in-google-dat to analytics/renaming-fields-in-google-data (still 40 characters).
I'm hopeful that without the initial forward slash, it won't look like a relative URL so Google won't 'discover' it. Over time, the partial URLs that are already listed in Search Console should drop out. If that fails, I could try replacing all the forward slashes with a different character entirely...
Anyway it's useful to know that Google will discover relative URLs from the page source like this. I'm sure there are all sorts of reasons why relative URLs might appear in your page source (not just ad targeting). In my case it was Google Ad Manager, but if you have the same problem, it could the result of a plugin perhaps.
The first thing to do is check your page source for those relative URLs, and the second thing to do is work out what is putting them there. The final thing, of course, is to stop it doing so.