WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#5306 closed enhancement (wontfix)

Canonical redirect conflicts with hosting provider's redirect

Reported by: vocaro Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: Canonical Keywords: reporter-feedback
Focuses: Cc:

Description

WordPress 2.3 includes a new canonical redirect feature. It is designed to deal with such problems as Google seeing yoursite.com and www.yoursite.com as two different entities.

Some hosting providers offer a similar redirect feature. With DreamHost, for example, you can configure your domain so that the web server redirects any request for www.yoursite.com to yoursite.com (i.e., it removes the www prefix).

When both of these features are enabled at the same time, they conflict with each other. You will experience HTTP errors such as:

Too many HTTP redirects

or:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

To fix this problem, you must go to the WordPress admin page and switch to the Options > General section. For the WordPress address and Blog address entries, remove the www prefix from both URLs.

The canonical redirect feature should be changed so that this problem doesn't occur. For example, canonical redirection could be disabled by default, or perhaps there is some way for WordPress to detect the www prefix removal by the web server and then automatically remove www from the URL entries in the WordPress settings. At the very least, there should be a documentation note on this problem and how to fix it.

This ticket is related to #5089 and #5017.

Change History (4)

comment:1 westi6 years ago

  • Keywords reporter-feedback added

Can you confirm what you have set in the WordPress Address and Blog Address sections of the options screen.

It sounds like you have them misconfigured.

comment:2 ryan6 years ago

  • Owner changed from anonymous to markjaquith

comment:3 markjaquith6 years ago

  • Status changed from new to assigned

Detecting redirects is tricky. And it can't be done on the fly -- too slow. Perhaps it could be done when you update your General settings. I don't know if this is widespread enough to justify all that code. I'd think that people who want a canonical domain would be consistent about it and not choose a web host redirect feature that points to the opposite of what they use on their blog.

Simple idea of how it could work on the General settings page: when you submit the form, WP does an HTTP HEAD on the main page of the blog, and determines if a 30x is returned to a new domain. If so, it updates the domain in siteurl and home -- maybe tells the user why the setting was overridden.

comment:4 Denis-de-Bernardy5 years ago

  • Component changed from General to Canonical
  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

it should not be WP's job to fix sites whose owners try to over-optimize their permalink structure.

and as Marc highlights, it's not really feasible, short of opening throngs of processes to verify that the redirect works. that's bound to generate infinite loops all over the place and get the site shut down.

Note: See TracTickets for help on using tickets.