homepage Welcome to WebmasterWorld Guest from 54.211.97.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
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

    
Importance of URL paths in links...?
Using ../.. instead of www.example.com/directory/
Ept103

5+ Year Member



 
Msg#: 28799 posted 10:55 pm on Mar 30, 2005 (gmt 0)

Let's say I have a link going to file.php under directory: "directory" ...

The link code is a href="../../file.php"

Is that going to lead to any indexing problems as opposed to a href="example.com/directory/file.php" ?

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 28799 posted 10:48 pm on Mar 31, 2005 (gmt 0)

I don't like relative URLs, ones that start ../../../etc.

I do like absolute URLs like www.domain.com/folder/folder/ but I don't like to include the full domain every time.

I use a 301 redirect from non-www to www and then relative URLs counting from the root, which is sort-of the same as absolute, but only with reference within the domain: /folder/folder/.

I never include the filename when linking to an index page. I always end any links to folders with a trailing / to avoid the automatic server redirect that happens when you omit it.

Saltminer

10+ Year Member



 
Msg#: 28799 posted 2:55 pm on Apr 1, 2005 (gmt 0)

I use nothing but relative addresses, as I can run the sites locally from the harddrive, and also place it on CD.

If you check Google you'll see that the results always have the full URL in the link. Google doesn't have any problem with relative URL's, anymore than your browser does.

tomda

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 28799 posted 3:21 pm on Apr 1, 2005 (gmt 0)

Follow g1smd advice: always use full URL and the redirect is also a good idea.

Also because, you use PHP, you can easily set a session variable which will should use the ENV variable to get


$http_dir="YOUR.DOMAIN.COM";
// GET URL_ROOT
if(isset($_SESSION["url_root"])) //CHECK IF VAR EXIST
{$url_root=$_SESSION["url_root"];} else {$url_root="http://".$_SERVER['HTTP_HOST']."/".$http_dir."/";
session_register("url_root"); $_SESSION["url_root"]=$url_root;}

So that all my links look like :
echo "<a href='".$url_root."images/blah/blah/page.php'>";

This way, links works in any host/location. Just need to change the two lines in your include.

Hope this help!

Herenvardo

10+ Year Member



 
Msg#: 28799 posted 5:03 pm on Apr 1, 2005 (gmt 0)


I don't like relative URLs, ones that start ../../../etc.
I do like absolute URLs like www.domain.com/folder/folder/ but I don't like to include the full domain every time.

I use a 301 redirect from non-www to www and then relative URLs counting from the root, which is sort-of the same as absolute, but only with reference within the domain: /folder/folder/.

I never include the filename when linking to an index page. I always end any links to folders with a trailing / to avoid the automatic server redirect that happens when you omit it.


Completely agree! ;)


I use nothing but relative addresses, as I can run the sites locally from the harddrive, and also place it on CD.

A easy way to go through this on windows: type on command line:

subst W: "[i]homepage local path[/i]"

then you'll have a virtual hard-disk drive W pointed to your web's local folder. Addresses from the root will be interpreted from W:

I've heard that similar tricks are available on other platforms, but i don't know about them.

Hoping be useful,
Herenvardö

mrMister

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 28799 posted 5:18 pm on Apr 1, 2005 (gmt 0)

Use relative paths wherever possible. Only use absolute paths when you're accessing another server.

Most internal links on the web are relative, crawlers are designed to handle them.

globay

10+ Year Member



 
Msg#: 28799 posted 5:31 pm on Apr 1, 2005 (gmt 0)

I use <base href="http://www.example.com" /> in my header, and href="subfolder1/subfolder2/" for my links. Since this part of the header is included with php, I can change it very easily, run it on my computer, etc. For me it is much more convenient than using something like "../../../subfolder".

Images are all in img/ no matter in which directory they are used.

When testing a new site I can move it to example.com/sandbox and just need to change the base href tag and it works.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 28799 posted 8:39 pm on Apr 1, 2005 (gmt 0)

>> subfolder1/subfolder2/

>> Images are all in img/ no matter...

I would use:

/subfolder1/subfolder2/ and /img/

Note the subtle difference.

mrMister

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 28799 posted 10:50 pm on Apr 1, 2005 (gmt 0)

/subfolder1/subfolder2/ and /img/

Note the subtle difference.

LOL, hardly subtle.

I totally agree. I wouldn't bank on a spider reading your BASE HREF. In globay's case, it would be wise to use paths from the root.

BigDave

WebmasterWorld Senior Member bigdave us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 28799 posted 11:14 pm on Apr 1, 2005 (gmt 0)

With a brand new, unindexed site, it is my experience that Google will index it faster with full URLs, including domain name and absolute path.

Once it is fully indexed, I generally drop the domain part of the URL, yet keep the absolute path.

I will only go with a relative path when the files actually belong together, and if I move them, they will be moved as a unit. For example if /greenwidget/part1/ links to /greenwidget/part2/ I will use "../part2/" in case I decide to move them both to /greenfuzzywidget/ at a later date.

DerekH

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 28799 posted 8:06 am on Apr 2, 2005 (gmt 0)

One of the problems I've found with relative paths is that when writing a custom 404 pages on Apache, the page is served as if it were at the location of the the missing page (for example 4 levels down), whereas (when using relative links), the links on the 404 page back into the site are relative to where the 404 page resides (for example 1 level down).

In this case, a 404 error isn't handled properly - you can get to the custom page and then the navigation doesn't work.

And of course, I did exactly that - and when tested it, I of course typed a duff address like www.example.com/rubbish.html, and of course I was convinced the 404 page was working!

Having said all that, I still use relative links for the rest of the site.
DerekH

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