Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#34609 closed feature request (duplicate)

Image URLs should be hostnameless and methodless by default

Reported by: meta's profile meta Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

The plugin https://wordpress.org/plugins/relative-image-urls/ implements behavior that I think ought to be WordPress's default behavior.

Consider:

  • Fewer HTTP requests, so faster page load time.
  • No problems with partially secure pages (some resources HTTP on an HTTPS page or vice versa).
  • Sites can be moved to a new domain without having to edit every single post and page to fix the URLs of the images.

Note that I'm not asking for image embedding to use relative URL paths, which has been refused previously for valid reasons.

Rather, I'm asking for images to be embedded with absolute paths but no hostname or method, so that the browser uses the hostname and method of the current page.

Change History (6)

#2 @SergeyBiryukov
8 years ago

Note that I'm not asking for image embedding to use relative URL paths, which has been refused previously for valid reasons.

Rather, I'm asking for images to be embedded with absolute paths but no hostname or method, so that the browser uses the hostname and method of the current page.

How is that different from a relative URL?

#3 @meta
8 years ago

I was thinking of relative URLs like page /foo/bar referring to ../../wp-content/04/2015/08/image.jpg -- which is obviously not a good idea.

I just had to change the URL of an MU install, and it was a major pain. Having the absolute URL encoded in every piece of rich text can't be the best answer.

What if images were inserted using a shortcode rather than raw HTML, and the shortcode generated the absolute URL at runtime? That way you'd still end up with absolute URLs in RSS feeds and e-mails, but it would be easy to change the base URL of the site without having to do a search and replace on every piece of content.

(You could also make the shortcode generate retina-ready srcsets into the bargain.)

#4 @swissspidy
8 years ago

  • Component changed from Embeds to Media

#5 @johnbillion
8 years ago

  • Type changed from enhancement to feature request
  • Version trunk deleted

FYI what you're asking for is root-relative URLs.

#6 @swissspidy
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #37723.

What if images were inserted using a shortcode rather than raw HTML, and the shortcode generated the absolute URL at runtime?

See #11394.

Note: See TracTickets for help on using tickets.