Support » Fixing WordPress » Don't put blog-URL in front of www-links.

  • Resolved nick_names

    (@nick_names)



    This has happenend to me more then once: I add a link in a blogpost not noticing that it doesn’t start with http:// but with www. only, e.g. www.link.com

    When I publish the article WordPress changes the link from www.link.com to http://myblogurl.com/www.link.com resulting in a 404.

    Live example here (link on the pic/gif): http://www.web-crap.com/wann-kommt-der-westwind/

    Is there any way to prevent this?

    Wait and if I put http:// in front of the url WP changes it to www.? (link on first word β€žLink.β€œ in text).

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator πŸš€

    Not really, that’s how URLs are supposed to work. http:// is what establishes it as an absolute URL.

    If you leave out http:// it’s a relative URL, meaning relative to where it is.

    As you’ve seen, if you put in http://example.com was an URL, it will be a link to http://example.com

    If you put it in as just example.com every browser will assume it’s yoursite.com/example.com

    As relative URLs are a valid thing, you include a URL as /images/funnyimage.jpg because it’s actually at yoursite.com/images/funnyimage.jpg, there’s no way to override the behavior.

    Thanks for the answer!

    I undertand that /images/funnyimage.jpg changes into http://www.yoursite.com/images/funnyimage.jpg that’s how it always works, I think.

    But the problem is not with URLs like example.com but with WWW.example.com. I think in a normal HTML file a href="www.example.com" would just link to http://www.example.com and not http://www.yoursite.com/example.com (why would I want that?)

    Shouldn’t WP treat www. just like http:// and see that it is an external domain and not put yoursite.com/ in front of it?

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator πŸš€

    Right, it’s still a relative URL without http:// or https:// that’s just how browsers work in general, and I don’t think there’s any plans to make WordPress the exception to that rule.

    I agree it would be nice, and maybe someone should make a plugin for it, I just don’t see WordPress itself adopting its own protocol in this regard.

    Wow, you’re right, I’m so sorry. HTML-only is the exact same thing.

    Well, consider this issue closed, I guess : (

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator πŸš€

    You’re welcome!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Don't put blog-URL in front of www-links.’ is closed to new replies.