• Hey Guys

    I’m building a site on a temporary domain and I’m having trouble with links. I have pages that reference links with “CLICK HERE to see document” but the only link they allow is a direct link, and when I move the site to a permanent domain I’m worried I’ll have to re-link everything.

    Is there any way around this? I just need to reference a file in the media library but when I click to link something it’s only bringing up pages, not media files.

    Thanks

Viewing 1 replies (of 1 total)
  • Moderator James Huff

    (@macmanx)

    WordPress prefers and pretty much forces absolute URLs whenever it can, as blogs are mainly consumed through syndication. For example, consider this:

    Your image is at example.com/image.jpg so you use just the relative URL /image.jpg in your post.

    But, I read your blog on https://newsblur.com/ and that image won’t load because it doesn’t exist at newsblur.com/image.jpg

    Or, I read your blog via email at https://mail.google.com/ and that image won’t load because it doesn’t exist at mail.google.com/image.jpg

    This is why WordPress prefers absolute URLs, so you use https://example.com/image.jpg in your post, and I can see the image in NewsBlur and Gmail because no matter where I’m reading your post, that image is always referencing https://example.com/image.jpg

    When you’re ready to move your site, it will be easy to search and replace those links using a plugin like https://www.ads-software.com/plugins/better-search-replace/

Viewing 1 replies (of 1 total)
  • The topic ‘Link to media file (relative links)’ is closed to new replies.