• I’ve always wondered why this is. Why WP puts the *entire* fully-qualified URL in each and every reference to a file, post, page, or anything else. Basically, every single href and src attribute contains the full “http://www.mysite.com”.

    I’m sure there’s a reason, but for a site that consists of only one url, this is not neccesary, and bloats the html.

    More importantly, fully-qualified urls are hardcoded in the content of pages and posts. That makes it a pain in the rear to deploy site+database from staging/test/accept environments to the live environment.

    So my question is: why is this?

    Secondary question that I feel coming up: how to disable this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Worpress does not like relative urls because the pages/posts ect. are dynamically produced and as such relative urls can go nuts.

    [edit] More here, http://codex.wordpress.org/Linking_Posts_Pages_and_Categories and scroll way down.

    Thread Starter thanatica2

    (@thanatica2)

    No, I think you misunderstand. I’m all for absolute url’s, but not for fully-qualified urls.

    This is a fully-qualified url:
    http://www.mysite.com/dir/to/a/file.php

    This is an absolute url – relative to the root:
    /dir/to/a/file.php

    and this is a relative url:
    ../../to/a/file.php

    Of course, relative url’s are not going to work, but absolute files will work *perfectly* in a wordpress environment. Just as long as you’re not using and linking to different domains for one and the same site. Which is almost never the case for wordpress installations.

    Relative urls only work when you can predict where they will be relative to as in the example you used as a absolute url.

    An absolute and fully qualified URL are the same thing.

    In addition to several other meanings, the word absolute, in English, means “not dependent on anything else”. It also means “free from doubt”.
    An Absolute URL is, thus, something that is independent or free from any relationship. When you use an absolute URL, you point directly to a file. Hence, an absolute URL specifies the exact location of a file/directory on the internet. It also follows that each absolute URL is unique, which means that if two URLs are identical, they point to the same file.

    Thread Starter thanatica2

    (@thanatica2)

    Let me rephrase then.

    Why does WP not generate url’s relative to the website’s root? e.g. beginning with a slash.

    Again, this would work completely flawless, and it would greatly improve deployment of a database from one environment to the next.

    Plugins like these shouldn’t have to exist:
    http://wordpress.org/extend/plugins/root-relative-urls/

    Why does WP not generate url’s relative to the website’s root? e.g. beginning with a slash.

    I don’t know the why, not a developer but I do know that wp uses permalinks, which are shortened absolute urls. This is done because that permalink can be called from many locations in and out of WordPress.

    Plugins exist for all sorts of reasons. That one is to help someone going from the development environment to a live site. I don’t know if it is needed. Never done that. The majority of wp users do not use any site development site or db.

    Perhaps a mod or someone with more knowledge will jump in here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Full domain in links and everything?’ is closed to new replies.