[wp-hackers] wouldn't internal links be more efficient?

Matt Martz mdmartz at sivel.net
Sun Feb 1 23:24:04 GMT 2009


On Sun, Feb 1, 2009 at 6:06 PM, scribu <scribu at gmail.com> wrote:
> One reason might be the fact that you can have encrypted pages that begin
> with https://

Another reason is that relative links will not work with feeds when
viewed in feed readers and other such uses.  In addition I cannot see
how using relative URLs would make things more efficient.  The load
generated by getting the blog url is minimal, and using relative URLs
would require getting the directory where WordPress is installed
relative to the document root, which would generate just as much load
as getting the blog url.

Using relative URLs in the end, would in my opinion, complicate things
further as you have to make sure that based on the url being accessed
that your relative or absolute URL is correct.  Using relative urls in
the form of href="wp-content/uploads/2009/02/test.jpg" do not work
well with pretty permalinks because if you access
http://example.org/category/news it will try to pull the image from
http://example.org/category/news/wp-content/uploads/2008/02/images/test.jpg
which is not what we want.  We would have to use absolute URLs in the
form of href="/wp-content/uploads/2008/02/images/test.jpg" and in the
case that the blog was installed in /blog that would be
href="/blog/wp-content/uploads/2008/02/images/test.jpg"

So it actually becomes more simple, easier and more compatible to use
a fully qualified URL containing the hostname and path to the file
than it does to use absolute or relative.

-- 
Matt Martz
matt at sivel.net


More information about the wp-hackers mailing list