Forum Moderators: open

Message Too Old, No Replies

Using a trailing slash on index page. How do you do this?

I've been told i might need this. Don't know. Please help.

         

frenzy77

3:34 pm on Sep 24, 2005 (gmt 0)

10+ Year Member



Hey guys:)

I have read that that if you do not add a "trailing slash" to your home page it will be called twice? Not certain if i read this right.

Q.1. What does this mean and how do you place the trailing slash in the url?

Ex.

I have seen sites that have 2 home pages i believe.
(not sure if i'm right about home pages but they have both of these.)

>One like this:
http://www.example.com/

>and a second like this:
http://www.example.com/index.html

Q.2. And how do you do the http://www.example.com/
for a webpage?

Q.3. Or can i just use the http://www.example.com/index.html
for my home page with no problems?(I'd rather do this)

Please help. kind of a newbie.

Please answer each question:)

Thanks guys for your help:)

frenzy77

[edited by: tedster at 7:57 pm (utc) on Sep. 24, 2005]
[edit reason] use example.com [/edit]

us60

7:45 pm on Sep 24, 2005 (gmt 0)




To answer question 1: Your server most likely requires that you name your start page with the filename index.html.

So if you place index.html in the root of your web space at example.com, you can address the site as http://www.example.com/ and your index page will appear.

You can also address the site as http://www.example.com/index.html and the same page will appear.

If you use the first method, there is less typing involved. But if you use the first method and your page does not appear, then your site may not be set up with index.html as its default start page. Refer to your site's documentation or support desk.

A second page on your site in the root may be named whatever.html. A link on the index page to the second page may be entered as <a href="whatever.html">linktext</a>.

A link in the second page may be coded as <a href="/">home</a> or as <a href="index.html">home</a>.

I will follow with questions 2 and 3

Larry

tedster

7:56 pm on Sep 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Servers most often have a list of what page address to default to when just the directory is given in a url. For example:

index.html
index.htm
default.asp
home.html

...and so on. This list would be specific to each server, not the same list everywhere on every host.

The big issue is that /www.example.com and /www.example.com/index.html are different urls even if they display the same "page". Search engines don't know about "pages" (that's not a technical word, it's an intuitive description used in conversation) they only know about urls. So if different urls are used, even if they point to the same "page", will be treated differently by the algorithms -- splitting up link influence, PageRank and other ranking factors rather than concentratingthem on one single url. This can really hurt.

us60

8:48 pm on Sep 24, 2005 (gmt 0)



I was going to follow with qyestions 2 and 3, but my first post covered numbers two and 3 after a fashion.

Tedster is correct in his post, and I have seen a site that I maintain have two listings in Google, one with www and another without. Also one ending in / and one ending in /index.html have appeared as separate listings.

And when that happens, the individual listings rank lower on the search page than a combined single link would.

While you generally should refer to pages on the same site with links containing the page name as in <a href="page2.html">linktext</a>, I have made an unhosted domain name work with my site by directing all on-site links as links to another site.

I own example.com, an unhosted domain, as an example.

I have a free webhost dot com web site. I send people to my home page using <a href;"http://example.com/">Home</a>.

Made the search engines recognize my unhosted domain name, which was set to redirect to the free site page.

This does introduce some performance drawbacks, however: slower transfers because the visitor is sent off to look up the dns for example.com and then go back and negotiate a new connection to the site he just left. Also greater risk of site downtime, as while the free host is up and running, perhaps the dns server handling example.com is fouled-up.

It also puts an extra load on the free host's bandwidth which results in poorer performance overall.

So if you can afford to host a site, it is better in the end.

Larry

frenzy77

6:14 pm on Sep 26, 2005 (gmt 0)

10+ Year Member



Hey guys:)

Thanks for your help:)
I appreciate your helpful replies.

Q.1. So if i use http://www.example.com/index.html

and place it in the root of my webspace, i will have no problems with the page being called twice?

Q.2. I read somewhere that if you forget the trailing slash, the page will be called twice. Not exactly sure why that is bad.
>Is it because the page will load slowly?

Thanks again for your help fellas:)

frenzy77

us60

6:59 am on Sep 27, 2005 (gmt 0)



Q.1. So if i use http://www.example.com/index.html

and place it in the root of my webspace, i will have no problems with the page being called twice?


I really don't see how a page would be called twice, that is, there being duplicate calls to the server for one serving of the page to the visitor.

Q.2. I read somewhere that if you forget the trailing slash, the page will be called twice. Not exactly sure why that is bad.
>Is it because the page will load slowly?

There is something in the back of my mind having to do with this..... I know that if I go to www.example.com, with no trailing slash, one is automatically appended. There may be a process run on the server to correct this oversight, that if it is properly created as www.example.com/ to begin with, that process is not run. Just how much server loading this process would create, if at all significant, is better answered by someone who is just a little more familiar with the inner workings of the server process.

Has anyone a suggestion of a search phrase that may bring forth the desired information from a search engine? Or a better grasp on this point than I can muster?

To make your site more user-friendly, you could set it up to have every url to pages on your site end in / instead of .html.

Assuming your site requires the use of index.ext as the default page for any directory, you could take membership.html and place it in the membership directory, renaming it there as index.html.

Visit, for instance, http://www.example.com/membership/ instead of visiting http://www.example.com/membership.html.

It would involve adding a folder to your site for every page you wanted visitors to link to from the outside world. (Folders in Windows = directories in dos.....)

If you have access to your .htaccess file, you may be able to change the default name of the page, so that membership.html may be the default in the membership/ directory. And so on.

Hope this helps!

Larry

g1smd

4:11 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Put the index file in the root of the domain, and call it index.html.

Later on, when you learn about scripting, you might want to change it to index.php instead.

On all of your pages where you link to the index file, link to it using just / or http://www.domain.com/ and it will work fine.

If you link to index.html then if you ever change to index.php then all of your links will be immediately broken. Omit the filename from the links!

If you omit the trailing / from the domain or folder then the server will have to issue an automatic redirect from www.domain.com to www.domain.com/ or from /folder to /folder/. Avoid that by including the trailing / on the URL (when you link to an index page).