Welcome to WebmasterWorld Guest from 54.147.212.98

Forum Moderators: ergophobe

Message Too Old, No Replies

Using directories vs file names

How

   
11:33 am on Jun 2, 2006 (gmt 0)

10+ Year Member



Lately I've been obsessed with building logical dir structures for my websites. Not just with the SEs in mind, but also for better organizing my content. I must say that for years I've only created websites of the type example.com/file.html with no directories at all.

For this site I'm working on, if I follow strict dir structure rules the site will look something like this:

example.com/dir1/dir11/dir111/
..........................

example.com/dir2/dir22/dir222/
............................

I have 2 concerns/questions here:

Dir1 and dir2 must be created just for building an "a la carte" structure, so they only contain the index.html file. Is this viewed as a good, non spammy practice (having empty directories)?

In addition the Dir111 and dir222 type directories also contain only the index.html files. There are about 400 of these and they are my content pages. I thought it might be better to use dir/ instead of files.html because in the future I might add more pages to these directories. Also, I might change file extensions someday.

In conclusion, to me using this structure containing only directories seems better as a long term solution, and from a correct website structuring point of view. But am I not unnecessarily complicating things? Thanks for your advice.

12:13 pm on Jun 2, 2006 (gmt 0)

5+ Year Member



If you give the directories meaningful names, a structure like that will be very userfriendly because the URL shows how each page fits into the structure. Your problem is that some URLs may grow rather long which may be a handicap in some search engines.

I have never had problems with search engines because I had directories with only an index page.

3:26 pm on Jun 2, 2006 (gmt 0)

10+ Year Member



Thanks. The reason I was concerned is because I don't see many directories ranking in Google. But I suppose not many people use them this way.
3:43 pm on Jun 2, 2006 (gmt 0)

WebmasterWorld Administrator buckworks is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Another advantage is that a URL like this:

http://example.com/sometopic/

has fewer characters than this:

http://example.com/sometopic.html

If you have a lot of internal cross-linking the saving can add up to hundreds of characters per page. That's A Good Thing in every way I can think of.

3:46 pm on Jun 2, 2006 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The future is extensionless! Content Negotiation.
5:15 pm on Jun 2, 2006 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Your biggest problem is maintaining a structure of dozens or hundreds of files all called "index.html". It becomes unmanageable after a while. If I'm building a static site I split the content into categories and use appropriate file names for each page within those directories with a .htm or .html extension. If the site is small, I simply put all the files in root.

For a dynamic site, I use mod_rewrite to create extensionless URLs from the variables - for example:

http://www.example.com/category/page

relates to two variables "category" and "page".

The problem with extensionless URLs is that you need to check how the server handles the presence or absence of the trailing slash - which should always be present when using physical directories. Yahoo, for example, lists such links without the trailing slash, forcing a 301 redirect to the correct page. Pages with extensions (best to always stick to generic extensions such as .html rather than .asp or .php) at least have the benefit of being absolutely clear. Don't forget that 99.99% of visitors will never look at the URL structure at all - it offers almost no real-world aid to usability except for type-ins.

As pageoneresults mentions, Content Negotiation is the way forward, but it is often not available by default on shared servers. This allows you to use standard files server-side but refer to them without extensions - the server will serve the most appropriate file dependent on different factors. For example you could have two index files:

/page.html.en
/page.html.fr

And the content negotiation would serve the page in English or French dependent on the language preferences defined in the user's browser - all this under the same URL:

http://www.example.com/page
6:10 pm on Jun 2, 2006 (gmt 0)

10+ Year Member



Thanks for the thorough explanation Encyclo. I had no idea what Content Negotiation was.
9:31 pm on Jun 2, 2006 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It's certainly something worth learning.

Content Negotiation [httpd.apache.org]
Content Negotiation: why it is useful, and how to make it work [w3.org]

12:50 am on Jun 3, 2006 (gmt 0)

WebmasterWorld Senior Member annej is a WebmasterWorld Top Contributor of All Time 10+ Year Member



My top page that gets almost all of my visitors and earnings is the index page of a subdirectory.

It's the links and other factors in the algo that gets it there, not wheter it is the root page or the main subdirectory page. And yes, I like the way I can give each subdirectory a name that specifically describes what is contained there.

I have to have subdirectories just to organize my site as well. You do have to be careful you don't put the wrong index page in the wrong directory. Always check after you upload.