Forum Moderators: open
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
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.
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
<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.
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