FURL Issues with non-existent index.php query strings

OK, so I have FURLS enabled, everything works fine, has been for years. But no I am noticing that in Google search console pages (from way back) have been marked as “Duplicate without user-selected canonical” Even though there is a canonical URL there.

While trying to resolve, I realized that modx seems to ignore an invalid query string. So:

www.kimballarms.ca/about/ - works fine, as does
www.kimballarms.ca/index.php?id=2 - as does
www.kimballarms.ca/index.php?route=foo&bar=foo … an invalid query string.

So the invalid query string always returns the home page, which is getting penalized by google as it sees it as duplicate content.

So, to fix I think I can just setup an .htaccess redirect for anything that starts with ?route= to go to 404 and they should eventually disappear.

However, how do I fix modx so that it (correctly) delivers a 404 for an invalid query string???

What exactly do you mean by “invalid query string”?
Usually you can add any random GET parameter to a URL without getting a 404.

Does the route GET parameter have any special meaning? Do you use it as the system setting request_param_alias?

I edited the post to clarify (didn’t realize my urls got changed to links)

But effectively, yes, any random string ~should~ probably be ignored, but you can get something like what I have happening when you alias an old domain that used query strings instead of FURLs.

So what happens is google gets a 200 response from something like my example (all the old routes had been indexed) and tags it as duplicate content… :frowning:

I don’t think there is anything built-in to MODX to avoid a request like www.yourdomain.com/index.php?route=foo from showing the home page.

You could write a custom plugin though, that runs on the event OnHandleRequest (or maybe OnMODXInit), checks the value of $_GET['route'] and then redirects ($modx->sendRedirect(...)) to the correct page (or returns an error → $modx->sendErrorPage()).

You could put a redirect for any URL with “route” in the query string to an actual .html file in .htaccess (it could appear to be a 404 page). Since that file exists, MODX won’t get involved.

As long as the rewrite rule is above the MODX re-direct to index.php, it should work, and ought to prevent duplicate penalties.

1 Like

It actually looks like I can manage them with SEO suite

Are you sure that works?
I believe SEO Suite does the redirects on the event “OnPageNotFound”. But in your case, this event won’t fire (because you request the home page, that does exist).

1 Like

I do not know!! I have not actually been able to get back to this particular issue… :frowning: