Why is Google Search Console detecting partial URLs for my WordPress site?

PUBLISHED 8 May 2023 - UPDATED 15 Aug 2023

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.

Partial URLs in Google Search Console

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):

Partial URL examples - Google Search Console

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:

Page with redirect - Google Search Console

WordPress redirect guessing

And the partial URLs were indeed redirecting, because of a WordPress feature that seems to have lots of different names:

  • redirect guessing
  • URL autocorrect guessing
  • partial match redirection

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).

Finding the referring page

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/.

Referring Page in Google Search Console

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...

Identifying the culprit - ad targeting

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:

googletag.pubads().setTargeting('postid', getDataLayerVal('postid'));
googletag.pubads().setTargeting('url', '/analytics/renaming-fields-in-google-dat');
googletag.pubads().setTargeting('category', 'Analytics');
googletag.pubads().setTargeting('categoryid', '44');

(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!

Fixing the issue

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.

Subscribe
Notify of
guest
4 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Darren
Darren
1 year ago

Hi James,
Interesting post chap. Could you not replace the forward slash with a back slash? Or does G still not recognise the difference between the two and treat them the same?

Hope you are well? I’m guessing you are back freelance full time?

Darren

Danny
1 year ago

I'm having the same problem. But in my case, I don't think it has anything to do with Google Ad Manager, since I don't use it.

James Clark
Hi! I'm James Clark and I'm a freelance web analyst from the UK. I'm here to help with your analytics, ad operations, and SEO issues.
4
0
What do you think? Leave a commentx
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram