Forum Moderators: open

Message Too Old, No Replies

How to specify anchor uri which takes you to the index for a directory

         

JamieCon

8:14 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



Firstly, I apologise in advance for the worst written subject line ever. You're looking at v3, and i'm just not prepared to put any more work in :)

Anyway, simple question. I want to create a link that takes the user to the index page for that particular directory. I am aware of how to create an absolute link by prefixing the file / directory name with a slash, however what I want to do here is simply link relatively to the index file in the directory.

Why don't I just use the actual filename? I'm hoping for some SEO benefit.

At present I am using a period [href="."] however i'm not sure if this is the correct method.

Can anyone comment?

Thanks in advance,

Jamie

tedster

5:13 am on Sep 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've never seen href="." before -- I'm not saying it isn't OK, but I don't think it's standard. If you're in subdirectory-a, I think the safest relative link would be href="../subdirectory-a/"

I'm very willing to be proved wrong about the "." thing, however.

You're right not to want both a link to index.ext AND a subdirectory link. That can split pagerank, anchor text influence and so on across two different urls when there's really only one page.

Robin_reala

9:39 am on Sep 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't prove you wrong Tedster about the '.' notation but traditionally '..' resolves to the parent directory and '.' resolves to the current directory. I've not seen the notation on its own before but I don't see why it shouldn't work.

us60

9:26 pm on Sep 24, 2005 (gmt 0)



I am running Apache web server, hosting a Web site at [localhost...] and can access this site whether I am on or off the Internet because it is running on my computer, and accessible only to me.

Of course, you can click on the above link and it will open your local web site if you are running a server on your computer at localhost.

I have it configured approximately the way my online sitehost has Apache runnung, and I found that
<a href="/">linktext</a>
works. Place this link in any page on the root directory to address the root default.

Not verified, but I would imagine that if you place it on any page within your directory structure, it will refer to the root default page of your site. I was also going to use the idea to refer to "subdir/" to visit the default page in the child directory named "subdir."

I have seen "../../images/" used in web sites to refer back to the parent and grandparent directory and up another branch called "images" in web site source online.

I hadn't thought of using "." as a current-directory default, but I will check that out!
Larry

encyclo

1:26 am on Sep 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not over-keen on relative linking (which is objectively harder for user agents to resolve), however the "." notation is standard for the current working directory in Windows and Unix. Personally, I would add the trailing slash as well to avoid any problems with browsers which can omit it. This would give you:

<a href="[b]./[/b]">index</a>

However, if you can use absolute values from the document root, I would recommend doing that - or perhaps considering using a

base href
meta tag to help avoid any URL resolution problems.

JamieCon

4:16 pm on Sep 26, 2005 (gmt 0)

10+ Year Member



Hi,

Thanks for all the helpful comments on this.

I am also usually a fan of absolute linking, however this particular site will be running jointly on both an intranet and the internet - with different addressing. It's complicated, but basically there are different priveliges available depending on where you're coming from, but it's basically the same files.

Anyway, the general opinion seems to be that "." signifies the current directory. As someone's already said, "./" would be more complete.

I'm assuming that it is the client that converts a relative link to an absolute one. Can anyone confirm this?

If the above is true, I've tested in IE, fx and Opera, and all seem to work OK. Should I accept this as a tentative OK that it's the way to go?

Thanks again for everyone's help,

Jamie