On Thu, Apr 09, 2009 at 01:14:18PM +0100, Steve Fosdick wrote:
On Thu, 2009-04-09 at 12:39 +0100, Chris G wrote:
A much simpler question than I originally envisaged (the more complicated one may follow).
What apache2 directive allows URLs to omit the trailing .html? Half of my pages work without the html and the other half don't and for the life of me I can't find a directive anywhere that would affect this.
E.g. I can refer to either:-
http://home.isbd.net/sidebar.html http://home.isbd.net/sidebar
and they both work
but if I go to:- http://home.isbd.net/manual/en/mod/core.html http://home.isbd.net/manual/en/mod/core
The first one works but the second one (without the .html) gives a page not found error.
Chris,
I know this is not a complete answer but I think this has something to do with automatic type selection.
The HTTP standard has the facility for the browser to request a document and, rather than specify the type via a file extension, specify the types of content it is prepared to accept, possible weighted by preference, via the Accept: header and then let the web server serve up whatever content it can find that is acceptable.
To do that, Apache would map the MIME types specified by the browser to file extensions and then search for content in preference order by appending the extension and checking if the file is there.
This still does not say why it works for one example and not for the next but at least it may give you a start point for some further research.
Well I've found out how to turn this behaviour on and off but I'm none the wiser as to why it happens. The page above:-
http://home.isbd.net/manual/en/mod/core.html
Is (of course) one of the apache documentation manual pages. There's a file in /etc/apache2/conf.d to set configuration for this, as follows:-
Alias /manual /usr/share/doc/apache2-doc/manual/
<Directory "/usr/share/doc/apache2-doc/manual/"> Options Indexes FollowSymlinks AllowOverride None Order allow,deny Allow from all AddDefaultCharset off </Directory>
If I remove the Options line and restart apache then the URL without the .html on the end works. Putting *any* Options line back stops the URL without the trailing .html from working. Even adding "Options All" which is supposed to be the default switches the behaviour.
I'm still confused! :-)
I actually started looking at this because I want to do some playing about with filters with filter actions being changed by file suffixes and need to understand what's going on above (and what drives it).