Basically, it’s a canonical redirection.
In WordPress, there is a function named redirect_canonical
, or there’s a canonical redirect feature which:
-
Provides an SEO enhancement which prevents penalty for duplicate content by redirecting all incoming links to one or the other.
For example, if one visits a single post page where the default or “non-pretty” URL looks like
https://example.com/?p=1
(1
is the post ID) and if “pretty links/URLs” (i.e. permalinks) are enabled on the site, then WordPress would redirect the request (or your browser) to the proper post permalink which may look likehttps://example.com/hello-world/
(hello-world
is the post slug).And that is to prevent search engines from treating the same post as two posts having a duplicate content, or that without the redirection, search engines would see two different URLs with the exact same content (despite the page source/HTML are different), hence a duplicate content penalty would incur for the site.
Other examples: ( Note: I intentionally omitted the protocol part (e.g.
https://
) )| Type | Sample Default URL | Sample Permalink (or "Pretty URL") | |--------------------|-------------------------------|-------------------------------------| | Single Pages | example.com/?page_id=2 | example.com/sample-page/ | | Category archives | example.com/?cat=1 | example.com/category/uncategorized/ | | Tag archives | example.com/?tag=my-tag | example.com/tag/my-tag/ | | Post type archives | example.com/?post_type=my_cpt | example.com/my_cpt/ |
-
Attempts to find the correct link when a user (or you) enters a URL that does not exist based on exact WordPress query.
I.e. If a
404
(“not found”) error was encountered, WordPress would try to resolve it by “guessing” what should be presented to the user, before eventually showing a404
error page.
And in your case, that second point is likely what’s happening — you don’t have a page with the slug contact
, so WordPress tries to find one which contains contact
in the slug, and because you do have one (contact-us
), that explains why www.mywebsite.com/contact
redirects to the www.mywebsite.com/contact-us
page.
And actually, that guessing part is quite cool.. in that if you’re lazy or don’t remember the exact slug, you could just type part of it. 🙂 But that’s just my opinion.
Hope this (revised) answer helps you!