Opened 10 years ago
Last modified 5 years ago
#30581 assigned defect (bug)
http/https pages have different canonical URLs
Reported by: | betzster | Owned by: | 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.
Attachments (1)
Change History (18)
#1
@
10 years ago
- Component changed from General to Canonical
- Milestone changed from Awaiting Review to Future Release
#3
@
9 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).
#6
@
9 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
@
9 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
@
9 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.
8 years ago
#11
@
6 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.
#13
@
6 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.
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.