Ticket #6890 (closed defect: fixed)

Opened 2 months ago

Last modified 2 months ago

Canonical redirection broken for empty host in 'home' option

Reported by: thenlich Assigned to: markjaquith
Priority: normal Milestone: 2.6
Component: General Version: 2.5.1
Severity: normal Keywords: has-patch
Cc: jergendutch@gmail.com

Description

The canonical redirection of the host part (e.g. www.example.com vs example.com) is broken if get_option('home') returns an empty host part. It returns an invalid redirect in this case.

Setting the 'home' option to an empty host name (e. g. '/') is necessary if the blog needs to be reachable from different domains or protocols (HTTP/HTTPS) without redirecting to a particular one, or when the resulting HTML output should be relocatable (not contain protocol nor hostname).

Attachments

patch-canonical-nohost.patch (407 bytes) - added by thenlich on 05/01/08 08:37:33.

Change History

05/01/08 08:37:33 changed by thenlich

  • attachment patch-canonical-nohost.patch added.

05/01/08 17:19:33 changed by ryan

  • owner changed from anonymous to markjaquith.

05/02/08 16:01:10 changed by Otto42

This seems to me to be very much an edge case that would be better handled by simply disabling canonical redirection entirely, via a plugin or something.

05/02/08 20:51:03 changed by thenlich

Such an option would be useful. It would be even better to (optionally) disable redirection not entirely, but selectively (for scheme:/host/path).

But that is independent from this bug: if siteurl does not contain a hostname, we cannot rewrite to it. But since a redirect needs an absolute URL, we must use the original from the request in this case.

05/06/08 10:22:49 changed by thenlich

  • keywords set to has-patch.

05/09/08 08:30:04 changed by jergendutch

  • cc set to jergendutch@gmail.com.

This feature is sorely needed by people using wordpress in a development/staging versus live environment where the same config must be used in both places, and so live should not get a development hostname by accident.

05/09/08 18:14:28 changed by markjaquith

  • milestone set to 2.6.

if siteurl does not contain a hostname, we cannot rewrite to it

True. So it's a good patch from a CYA perspective, even if your intended use is unorthodox.

05/09/08 18:23:06 changed by markjaquith

  • status changed from new to closed.
  • resolution set to fixed.

(In [7916]) Do not use the "home"-supplied host for canonical redirects if no host is there specified. props thenlich. fixes #6890