Make WordPress Core

Opened 11 years ago

Last modified 7 years ago

#30581 assigned defect (bug)

http/https pages have different canonical URLs

Reported by: betzster's profile betzster Owned by: joostdevalk's profile joostdevalk
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Canonical Keywords: needs-refresh https SEO
Focuses: Cc:

Description

If you have SSL turned on, but don't force redirect, http and https pages will have different URLs. Ideally, I think the canonical URL should always use http unless FORCE_SSL is turned on.

Even a filter for rel_canonical would be better than what we have now. Unhooking and creating your own version of rel_canonical() works, but if multiple plugins do this, you end up with multiple canonical URLs set on every page.

Related: #18660, #14458

Attachments (1)

30581.1.diffโ€‹ (1.1 KB) - added by peterwilsoncc 11 years ago.

Download all attachments as: .zip

Change History (18)

#1 @johnbillion
11 years ago

  • Component changed from General to Canonical
  • Milestone changed from Awaiting Review to Future Release

Note that FORCE_SSL doesn't exist yet. See #28521.

I think this can go hand in hand with #28521. There are too many gotchas if we try to automatically enforce any given scheme on a site. See #29708.

#2 @johnbillion
11 years ago

  • Version changed from trunk to 2.9

#3 @peterwilsoncc
11 years ago

30581.1.diff forces the scheme of the rel_canonical URL to match that of the home page defined in options > general.

The current behaviour remains for URLs without the http, https or relative protocols (check is taken from get_home_url).

#4 @peterwilsoncc
10 years ago

  • Keywords needs-refresh added

#5 @johnbillion
10 years ago

  • Keywords https added

#6 @newash
10 years ago

  • Keywords changed from needs-refresh, https to needs-refresh https

+1 for the filter option, it would be really nice and also non-intrusive.

#7 @joemcgill
10 years ago

Just ran into this myself. A filter would be nice, but in the mean time, forcing the site to respect the scheme set in the home option as 30581.1.diffโ€‹ suggests so the canonical URL doesn't change based on context.

#8 @joemcgill
10 years ago

Alternately, it looks like the approach in #36168 would be to replace the get_permalink() call with a call to a new function, get_canonical_url().

This ticket was mentioned in โ€‹Slack in #core-http by joemcgill. โ€‹View the logs.


9 years ago

#10 @joostdevalk
8 years ago

  • Keywords SEO added
  • Owner set to joostdevalk
  • Status changed from new to assigned

#11 @SergeyBiryukov
8 years ago

If you have SSL turned on, but don't force redirect, http and https pages will have different URLs.

Found a related issue: if you have a static home page set, it does force a redirectโ€‹. Posts and other pages don't.

#12 @SergeyBiryukov
8 years ago

  • Milestone changed from Future Release to 5.0

#13 @palmiak
8 years ago

The filter was introduced in wp_get_canonical_url in WP 4.6. I think that adding another filter in rel_canonical would be a duplicate.

#14 @pento
7 years ago

  • Milestone changed from 5.0 to 5.1

#15 @pento
7 years ago

  • Milestone changed from 5.1 to 5.2

#16 @johnbillion
7 years ago

  • Milestone changed from 5.2 to Future Release

@joostdevalk Wanna pick this up again in 5.3?

#17 @joostdevalk
7 years ago

Is there a way for us to detect that https is "working" for a site? Because if so all our canonicals should always be https.

Note: See TracTickets for help on using tickets.