homepage Welcome to WebmasterWorld Guest from 54.226.80.55
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Google / Google SEO News and Discussion
Forum Library, Charter, Moderators: Robert Charlton & aakk9999 & brotherhood of lan & goodroi

Google SEO News and Discussion Forum

    
Relative or absolute internal links
FlyOcean




msg:4452820
 8:25 am on May 13, 2012 (gmt 0)

For Google Panda, is it better to use relative or absolute internal links ?

 

tedster




msg:4452853
 12:34 pm on May 13, 2012 (gmt 0)

Panda doesn't really enter into it, as far as I can see. However, I find that using root-relative links (those that begin with a forward slash) plus accurate canonical meta tags (where the href attribute includes the domain name) is an approach that offers the most accidental trouble and doesn't bloat the size of the source code.

g1smd




msg:4452876
 2:00 pm on May 13, 2012 (gmt 0)

I concur. Begin all links like href="/thisfile" with a leading slash.

Especially avoid the href="thatfile" and href="../otherfile" formats.

The reasons for not using the last two formats become painfully obvious once you start using "friendly URLs" and "URL rewriting".

lucy24




msg:4453003
 12:01 am on May 14, 2012 (gmt 0)

an approach that offers the most accidental trouble

?

g1smd




msg:4453009
 12:16 am on May 14, 2012 (gmt 0)

One small accident with an unintended relative link combined with a sloppy RewriteRule pattern beginning (.*)/ can lead to infinite duplicate content.

piskie




msg:4453012
 12:19 am on May 14, 2012 (gmt 0)

an approach that offers the most accidental trouble

Confused me as well.

enigma1




msg:4453173
 10:19 am on May 14, 2012 (gmt 0)

For Google Panda, is it better to use relative or absolute internal links ?

Depends on your site really and how you want each page to be accessed. You may have to use absolute ones if you want certain pages to be accessed in https and others in http. Relatives won't work well.

Another issue is with content management. If you manage the site via an admin folder and want to preview some content within the folder, the relative paths may point to the wrong path, using absolute paths prevents these problems.

I am not 100% sure how googlebot views identical links exposed in different modes and depends on the configuration. To be on a safe side in these cases I will use absolute internal links. And keep an eye on the configuration vs what the bot indexes. There are various mistakes that can cause undesirable effects.
[webmasterworld.com...]
What you read there it's because of relative paths.

deadsea




msg:4453188
 11:13 am on May 14, 2012 (gmt 0)

If you use all absolute urls on your site including the host name: http://www.example.com/link.html then the repetitions of "http://www.example.com/" on a couple hundred links on the page can really add up to increasing your page size unnecessarily.

g1smd




msg:4453192
 11:18 am on May 14, 2012 (gmt 0)

Yes, and you'll also get "mixed security" warnings on https pages when using images that are common to both sides.

The solution is to use URLs that begin with a slash and show the full path to the file. These are "relative to the root" and therefore "absolute within the site".

gouri




msg:4453299
 2:50 pm on May 14, 2012 (gmt 0)

I concur. Begin all links like href="/thisfile" with a leading slash.


@g1smd,

I am trying to figure out, if I had a domain [buildgreatwidets.tld...] and wanted to link to [buildgreatwidgets.tld...] would it be href="/blue.html"

Also, I read somewhere that it is good to use absolute links such as [buildgreatwidgets.tld...] when linking from [buildgreatwidets.tld...] because that way if [buildgreatwidets.tld...] is published somewhere, there will be a link going back to [buildgreatwidgets.tld...] and it is acknowledged whose content it is.

Can the same be accomplished by the way you are saying to link from one page to another?

And would I be able to link from one page to another the way that you are saying if using a website builder?

I appreciate your help.

netmeg




msg:4453307
 3:00 pm on May 14, 2012 (gmt 0)

If you are linking between two entirely different domains, then you need to put the absolute address in. Relative links won't work.

MonkFish




msg:4453311
 3:06 pm on May 14, 2012 (gmt 0)

an approach that offers the most accidental trouble = means less mistakes when creating new pages etc. you always have to know how many levels down you go ../../ etc whereas if it is just /folder/page.html you have less chance of making a mistake.

gouri




msg:4453317
 3:12 pm on May 14, 2012 (gmt 0)

If you are linking between two entirely different domains, then you need to put the absolute address in. Relative links won't work.


In the example that I mentioned, I am linking within the same domain (internal links).

lucy24




msg:4453366
 4:37 pm on May 14, 2012 (gmt 0)

In the example that I mentioned, I am linking within the same domain

... and that's why everyone keeps telling you to use example.com

http://www.example.com/link.html
vs.
[domain.com...]

:: twiddling thumbs ::

That being said: I still use relative links for most images and stylesheets. Why? Because my pages come in packages. If I move the package, the images will move right along with the pages and will remain in the same relative location, even if they're not in the same absolute location.

piskie




msg:4453377
 4:56 pm on May 14, 2012 (gmt 0)

So let me get this right Lucy, You use /folder/page.htm
Not ../folder/page.htm

crobb305




msg:4453378
 5:00 pm on May 14, 2012 (gmt 0)

this has become a confusing thread, particularly since the linked examples do not work.

gouri




msg:4453379
 5:06 pm on May 14, 2012 (gmt 0)

Not trying to make things more confusing, but if linking to your home page from other pages on your site and/or the footer, is it better to use a trailing slash.

http://www.example.com/ instead of http://www.example.com

g1smd




msg:4453464
 7:17 pm on May 14, 2012 (gmt 0)

Link to:
href="/" for the home page
href="/thispage" for a page in the root
href="/folder/thatpage" for a page in a folder, and so on.

Banish the
../ notation from your links forever.
gouri




msg:4453466
 7:26 pm on May 14, 2012 (gmt 0)

Thanks.

I agree that root-relative links are a good way to go for internal links.

In some instances, when you may have to use an absolute url when linking to the home page, would you include a trailing slash in the href portion of the code?

g1smd




msg:4453474
 7:37 pm on May 14, 2012 (gmt 0)

Yes, the root page of a site ends with "/".

It's either
href="/" or href="http://www.example.com/"
gouri




msg:4453475
 7:39 pm on May 14, 2012 (gmt 0)

At the moment, I don't have the trailing slash in absolute links to my home page.

It has been that way for years. Would it be good to make the change and add the trailing slash?

In the SERP, when I look at the home page URL, a trailing slash is included (just wanted to mention this, not sure if it affects if I should make the change or not).

g1smd




msg:4453523
 9:34 pm on May 14, 2012 (gmt 0)

I'd make the change just to be "right".

deadsea




msg:4453528
 9:56 pm on May 14, 2012 (gmt 0)

When it comes to the home page of a domain, it is the one place in which the trailing slash doesn't matter too much.

http://example.com/
and
http://example.com
are the same url. There is no duplicate content issue.
When a web browser requests them, it has to send a request that looks like:
GET / HTTP/1.1
Host: example.com

This is different than
http://example.com/folder
and
http://example.com/folder/
in which the URLs could be configured to serve different content.

Having the slash on the end of the domain link makes it more like what the request that gets sent looks like and makes it seem more like the subdomain case. However it adds complexity (and one character to the url). I think it is a style issue more than a canonical/duplicate content issue. Its a similar issue as to whether or not the domain name is capitalized http://example.com vs http://example.com. It doesn't matter in terms of content.

lucy24




msg:4453548
 10:46 pm on May 14, 2012 (gmt 0)

So let me get this right Lucy, You use /folder/page.htm
Not ../folder/page.htm

For links to other areas of the site I use /folder/page.html
For links within the same area I often use page.css or images/pic.jpg. I do have one area that uses ../motherpage.html because that's how the packages work.

:: avoiding eye contact with g1 ::

At the moment, I don't have the trailing slash in absolute links to my home page.

It has been that way for years. Would it be good to make the change and add the trailing slash?

In the SERP, when I look at the home page URL, a trailing slash is included (just wanted to mention this, not sure if it affects if I should make the change or not).

gouri, meet mod_dir. mod_dir, meet gouri. What you have there is the Directory Slash Redirect, which happens automatically with all real directories unless you've explicitly given orders to the contrary.

The home page is a special case. There, the browser itself sticks a slash / onto the end. So no matter what your link says, it will have a / by the time the request reaches your site.

gouri




msg:4453589
 2:01 am on May 15, 2012 (gmt 0)

I appreciate the responses.

I was doing some research about absolute and relative urls, and I saw relative urls mentioned as href="blue.html"

Is this the same thing as href="/blue.html"

I am trying to determine if these are both ways of indicating root-relative links or is href="blue.html" something else?

@gs1md may have made mention to this early in the thread (post #4452876) but I am not certain that it is the same thing so I wanted to ask.

I have also read that if you use absolute urls and your domain name contains some keywords in it, that can help with rankings. There is more code when absolute urls are used, but I heard that the additional mentions of keywords in your code can be helpful.

Has anyone heard this?

Thanks.

tedster




msg:4453603
 4:21 am on May 15, 2012 (gmt 0)

is href="blue.html" something else?

That URL indicates a resource that's in in the current directory - the directory where the current URL exists. So if the current URL is in the root directory, then there's no difference. But if it is in a subdirectory, then it is VERY different.

I'd suggest you experiment on a local version of a website, using all kinds of configurations. This will help set the variations more firmly in your comprehension.

lucy24




msg:4453605
 4:39 am on May 15, 2012 (gmt 0)

I was doing some research about absolute and relative urls, and I saw relative urls mentioned as href="blue.html"

Is this the same thing as href="/blue.html"

No. It may happen to yield the same page if you start out in your top-level directory, but the meanings are entirely different.

:: shuffling papers ::

[w3.org...]

Do not try to read it all in one sitting.

g1smd




msg:4453608
 5:21 am on May 15, 2012 (gmt 0)

With a page relative link you would link to
http://www.example.com/folder/page2 as
href="page2" from http://www.example.com/folder/page1
href="folder/page2" from http://www.example.com/
href="../folder/page2" from http://www.example.com/otherfolder/page5

With a root relative link you would link to
http://www.example.com/folder/page2 as
href="/folder/page2" with a leading slash from anywhere and everywhere on the same site.

The latter method is preferred and is the only viable solution if your site uses URL rewriting.

enigma1




msg:4453648
 9:07 am on May 15, 2012 (gmt 0)

Yes, and you'll also get "mixed security" warnings on https pages when using images that are common to both sides.

That's what happens when you ignore the connection method.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google SEO News and Discussion
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved