Setting canonical URL for WordPress site

[ad_1]

I’m helping someone with a WordPress site who is concerned because users typing “www.domain.com” cannot find the site; it was originally built on non-WWW.

I understand this can be changed in WordPress General Settings, but when I do so, all site pages are accessible via BOTH WWW and non-WWW; it would seem that Google would frown on this as duplicate content.

The installed SEO plugin (AIOSEO) evidently does not allow the setting of a site-wide canonical URL–only at the individual Page/Post level.

Can I simply insert the following code snippet in the site header, to redirect ALL non-WWW requests to the canonical WWW URL?

<link rel=”canonical” href=”https://www.domain.com/” />

[ad_2]
1 Comment
  1. Is the subdomain www pointing to @ or the server IP? That is where I would start.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer