Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trailing slash in a URL - good/bad?

Status
Not open for further replies.

BabyJeffy

Programmer
Sep 10, 2003
4,189
GB
An SEO company recently compiled a report for one of the websites that I've been involved with. They didn't find very much that we could change, and appear to be "scraping the barrel" for suggestions.

One recommendation they have (and one which the business want me to implement) is to "tidy up the use of URLs". For instance, they suggested we change all our links from:


To:


Followed by a requirement that we pass back 302 redirects when someone requests a URL with a trailing slash (and redirect them to the same URL without the trailing slash).

Some googling on the topic turns up a few interesting articles on this (the URLs were copied from Google and have a trailing slash):


I'd appreciate some input from the board on what value this is going to achieve - and whether or not they are blowing nothing but hot air.

Regards,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
I saw this article on developer.yahoo.com ( ) that seems to suggest you should keep the trailing slash
One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to results in a 301 response containing a redirect to (notice the added trailing slash). This is fixed in Apache by using Alias or mod_rewrite, or the DirectorySlash directive if you're using Apache handlers.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
I think the only possible drawback is that they would be seen as different pages.

However. How dumb do they think Google is? I'd put money on Google doing exactly the same as a webserver would and simply convert a non slashed url to one with a slash.

If they were building a search engine spider would they deliberately see the two as different urls? I don't think so.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
I understand the trailing slash is important and should be included as it reduces the load on the servers (for the previously given reason.)

Ideally you'd use the full path, ending in 'index.htm' or whatever if it is known.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
My home page
 
...Ideally you'd use the full path, ending in 'index.htm' or whatever if it is known.

Well, we don't serve .htm or .html or any other kind of document... we're using Grails and use an interceptor to determine the content to display based on the URI (and so the trailing slash is actually the right thing for us to deliver based on the architecture we use).

It's not a big deal - I've already had so many other examples of this seo agency offering inconsistent (and plain incorrect) advice... so I'm pretty much ignoring the change requests they send through now.

Cheers for your feedback,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
I think the "issue" is that when you make a non-slash request, the server...

looks for a file with that name;
finds it's a directory;
reads the directory looking for index.htm (or whatever);
returns that file.

Doing all that stuff is slower and requires more processing than if you'd asked for the file directly - hence much wailing and gnashing of teeth on he optimisation front.

HOWEVER we're talking about it being slower by a couple of microseconds. You'd have to have massive amounts traffic for this to make any discernable difference to the end-user or to your server load.

Having pretty URLs that aren't tied down to any particular technology (as .../index.htm would be) is more important than such tiny efficiencies.

What is important is that you always use the same URL to refer to the same page. If you don't, there's a danger that Google will think that [tt]page[/tt], [tt]page/[/tt] and [tt]page/index.htm[/tt] are three different pages.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top