Forum Moderators: DixonJones
[w3.org...]
Secondly remember that .html, .htm and .php and any other extension do NOTHING for your visitors, and are simply a means of offloading some of the work of configuring your webserver properly onto your visitors. In effect you are askign them to tell your webseever HOW to produce the page, not which one.
In all recent websites (since I "got it") I have no used extensions. I've only usedquery strings if it is indeed a query, such as a backend submission or a search. Everthing else is a neat list of strings seperated by slashes.
Also one of the FIRST things I do before startign work on a new site is to think of the URL structure. Identify a fitting url for each object of the site. Please note that I'm not referring to directories or folders, since they are largly irrelevant. Most of my websites have a single real page:
index.htag (for my own scripting language)
but index.exe or index.php (or asp or whatever) will do just fine.
This simple rewrite rule in Apache:
RewriteEngine on
RewriteRule ^/(index\.htag/)?([^.]+)$ /index.htag/$2 [L]
Will ensure that any address is passed into the script. Inside the script you simply strip the scriptname and then use the rest to identify the page you want to deliver.
so if your site is widgets.com you should have a structure like this:
www.widgets.com/
www.widgets.com/products
www.widgets.com/forums
www.widgets.com/about
www.widgets.com/products/widget_a
www.widgets.com/products/widget_b
www.widgets.com/products/widget_c
www.widgets.com/forums/forum1
www.widgets.com/forums/forum1/page2
you get the idea. Any and all of them can be dynamically created. images can also be referred to as plain files as the rule excludes URLs with dots in them.
I've found this setup supremely indexable. I never have problems of google not indexing my sites. In fact I have to struggle hard if I want to keep google out of places (such as a backend). Futher it's VERY easy to parse URLs inside a script rather then completely in complex rewrite rules.
And you can make it as dynamic as you will. Database lookup anyone? widgets.com/product/id463254352432 no problem.
I hope this will inspire some to adopt a extension less scheme, and follow up on the W3Cs dream of a cleaner and neater web :)
SN
However, the only question I have (not having tested this with many browsers), won't some browsers have issues accessing content that does not specify an file extension?
Some browsers (incorrectly) guess the mime type from the extension and ignore the Content-Type header. I've been bitten by this in the past when generating non-HTML content from a perl CGI application. I believe the problem was primarily with IE, but I wonder if other browsers have the same problem.
If you'Re creating non-html content form a script, such as images, javascript or css data, always make sure to include the proper "Content-Type:" header.
If you experienced this phenomenon with proper mime types, it must have been a very old, VERY buggy browser... good riddance.
Good Luck,
SN