Forum Moderators: phranque
I recently came across several articles on this issue and having already observed this on properly structured websites i.e. I would appreciate if someone could point me out how and where to start. I want the links to point to a directory i.e. www.example.com/category and not www.example.com/category/whatever.html. As whatever.html is likely to change its extension over time, it would useful to always refer to directory. I have already seen various posts i.e. http://www.webmasterworld.com/forum10/11371-2-10.htm as well as resources: http://www.w3.org/Provider/Style/URI.html#remove and http://httpd.apache.org/docs/2.0/content-negotiation.html . These suggest the use of content negotiation. The problem is that they most deal (especially the Apache doc) with the 'variable language' point of view and how to make the server choose the right language for the user. My content is static and is in English (content-lang: en, charset: UTF-8) and the server is Apache/2.0.52 (CentOS).
As far as I understood it, I won't have to worry about choosing 'qs' for different document types, as I am only concerned with picking the appropriate .html file for each link, but I am not sure how to actually do that (i.e. which file(s) I need to edit and what to edit). Do you by any change are aware by any 'content negotiation for dummies' resources that I can start with (although I know it is not quite a dummies' subject). Unless I am wrong, I can see two disadvantages with using content negotiation: a) Having an .html file per directory i.e. if I have a large page that needs splitting I will have to have:
www.example.com/category1
www.example.com/category2
while under normal circumstances I would be able to have both .html files under www.example.com/category/ and refer to them appropriately.
b) It is not only .html that would need adjustments for content negotiation i.e. .rss, .png.
I presume that content negotiation, once configured properly is a real investment for the future of a website. For example, referring to a directory and not a file, ensures that also PR gained over the years won't be lost, in case .html file extensions are being replaced with something else. That brings me to my second part of my query: the base url tag.
I know that the base url tag is used for dereferencing relative urls, thus being helpful on the spiders in some way, in a relative link-based site. Although this approach won't be as comprehensive as with content negotiation, would it be possible to have a base url of any .html files under that category pointing at: www.example.com/category/ (I am not sure about the last trailing slash)? Would that method, at least in terms of SEO, transfer the PR from any .html files towards the containing directory (www.example.com/category)? Still, that won't be a proper future-proof solution as file extension changes are eminent, but would it do the trick by moving PR towards the directory (which of course will remain the same).
Any suggestions to any of my queries are most welcome and please do not hesitate to correct me if I am wrong somewhere. I will appreciate it!
Regards.
In that case, the local URL-path /category/category1 refers to an extensionless file called 'category1' residing in the directory /category/. And using this approach, content-negotiation simply takes the request for /category/category1 and tries to find the best-match existant filename to serve that request.
Given a choice between the two files category1.html and category2.html, it would choose category1.html, and all would work as you desire.
From that point, you can see that the resolution of relative links is a non-problem, since the browser would resolve a relative link by removing the extensionless filename from its current location (as shown in the browser's address bar) and appending the relative link path to whatever is left.
It's actually simpler than you think it is... ;)
Jim
Are you aware of any newbie resources on content negotiation? I d like to have a go at it if I manage to fully understand it and feel confident to make such change. I would like to get things sorted now, rather than have to do it years later. I wish it was that easy for me:-(
Regards,
Jason