It usually isn't problematic to have Google choose to index a different canonical. Your page is still getting indexed and ranked in Google. Users are just getting sent to an alternate URL which still works.
That being said, you can try to get Google to index your preferred canonical URL. Google uses several signals to figure out which URL is the canonical:
- Canonical tags
- Redirects
- Links to the page
- XML sitemaps
When Google chooses a different canonical, it is usually because it isn't getting consistent data from all those signals. To get Google to index your preferred canonical:
- Use canonical meta tags in myPage that specify the canonical URL to be
http://www.example.com/myPage
. Make sure the URL is fully qualified.
- Redirect alternate URLs using "301 permanent" redirects. Redirects are usually a stronger signal for canonical purposes than canonical tags. So make sure
http://example.com/myPage
redirects to http://www.example.com/myPage
.
- Fix any links that point to the non-canonical URL. If you have any links on your site that point to
http://example.com/myPage
, fix them yourself. If there are external links that point to http://example.com/myPage
then contact the site with the link and ask them to change it.
- Create an XML sitemap, submit it to Google, and ensure that it only lists your canonical URLs. Make sure that
http://example.com/myPage
is purged from any existing XML sitemaps.
Once Google sees everything pointing to the same canonical URL, it will eventually choose to index the user-chosen canonical. Google will start switching the URLs on your site over one by one within a couple weeks. For the least popular pages on your site, it could take months or even a year.