Remove domain name from media upload urls and internal links

  1. ImajWorks


    When a user uploads a media file to a post/page, the full url is included. When a site owner changes domain names, this requires a full search and replace in the database - this isn't something that a typical end-user would know how to do or feel comfortable doing.

    Images uploaded through the media library and inserted with the media upload button into a post or a page should drop the domain name from the url, ie: "/wp-content/uploads/11/2014/image.jpg," so that when transferring the site's content to a new domain name, there are not broken links all over the content.

    Posted: 4 years ago #
  2. There are plugins that can do this, and this is not the first time this has been proposed.

    At this time, there are no plans to introduce relative URLs, as it would over complicate moving WordPress, changing URLs, multisite, and moving the wp-content folder.

    Posted: 4 years ago #
  3. I think this is a reaaly useful feature and needed to be implemented inside the core functionality. As wordpress uses absolute url in the site, it became very hard when migrating to HTTPS. WordPress should use protocol relative url everywhere so that the pain become less. Like //example.com/some.png
    Now if anyone know any plugin that can do that, please tell me. I wanna know. It took 6 hrs to migrate my site froperly to https due to this absolute urls.

    Posted: 3 years ago #
  4. Simon East

    "...it would over complicate moving WordPress, changing URLs, multisite, and moving the wp-content folder..."

    I actually believe the current use of absolute URLs does more to complicate moving WordPress and changing domain names, don't you think?

    Posted: 2 years ago #
  5. Surprisingly no when you consider regex and searches :)

    Search for http://www.olddomain.com/wp-content/uploads is way more likely to be accurate than just olddomain.com or olddomain.

    Also it means you can easily move all your images to a CDN while keeping your URL, since we can do a simple filter and not worry about catching content that shouldn't be caught.

    If you've never had to scrub out someone's DB who's tried just replacing the domain name, you're lucky.

    Posted: 2 years ago #
  6. I still thinks that WordPress should consider using protocol relative url like //www.example.com/wp-content/uploads/something.jpg when any image or media gets added into the post using the post editor. Otherwise when a site gets migrated from HTTP to HTTPS, these urls are the main reason for mixed content issue unless the user edit every single page or posts and update the image url.

    This is really a big pain.

    Posted: 2 years ago #
  7. That's a different matter all together :)

    Posted: 2 years ago #
  8. Well if this is a different matter altogether then when I submitted this idea in wordpress why did you rejected that as duplicated? While it was a unique issue.

    Here is the link: https://wordpress.org/ideas/topic/use-relative-protocol-url-in-wordpress

    Posted: 2 years ago #
  9. Because:

    * https://wordpress.org/ideas/topic/make-editor-use-relative-links#post-3442
    * https://wordpress.org/ideas/topic/relative-instead-of-absolute-urls

    I know the search sucks, but that one has been out there for years.

    * https://core.trac.wordpress.org/ticket/17048 for the trac ticket (which is when we tend to close ideas - if there's a ticket, the posts here get closed)

    Posted: 2 years ago #
  10. Well its a loong ticket and a looong way to go before actual implementation. lol. Good to see that other people also care about this stuffs :)

    Posted: 2 years ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    7 Votes
  • Status

    Sorry, not right now