After reviewing Google Analytics and ad traffic we realized that people were able to find pages on client sites in a very odd way. Replacing the hyphens with periods.
For example…
Correct permalink: www.domain.com/this-is-a-link
Incorrect: www.domain.com/this.is.a.link
Both work and send the user to the same page. But I’m not sure why. We tried various browsers and it seems to work the same in all of them. Normally, this would be helpful to the user (generally speaking) but it is skewing the analytics.
I suspect the ad campaign folks created a link with the periods which started the problem. But even with fixing that, it doesn’t answer the question of why this even works or how to disallow this behavior / functionality.
Any thoughts?
WordPress uses mod_rewrite for permalink. And mod_rewrite uses pattern matching in your urls to distinguish what to rewrite and what not to rewrite within your .htaccess file.
The
.
character actually means any character in regular express pattern matching which is what mod_rewrite used to determine what to rewrite.to illustrate this better, take your example
to be the correct link that you desire but in the case of
it will also match as
.
is being read as-
since single dot means any characteryou can read more about mod_rewrite to get a better understand why period is being read as dashes too.
The only way to solve this is to rewrite the default WordPress native mod_rewrite pattern or report this as a bug to ask the core communities to list it as a bug would be more appropriate. But this seems pretty common even with large site such as eBay with url
the url with
is also valid. i believe this is a limitation in mod_rewrite so you might want to live with it.