You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Robert Cailliau <ro...@cailliau.org> on 2013/05/25 20:09:37 UTC

[users@httpd] Re: option indexes and rewrite

Hi Pete,
  Thank you for your fast reply:

>	I would use DirectoryIndex and mod_autoindex for this and certainly
>would not go anywhere near mod_rewrite.
>
>         DirectoryIndex	" c-en.html"

No, that does alas not achieve my goal at all.
In my request I could of course not give a long explanation for the rationale.
It's all about my own personal documents.
I'm moving towards "liberating" my personal files from proprietary 
formats and use web technology instead. So far I have achieved this 
for everything except spreadsheets.
Each document now is a folder: in the folder sits an html file plus 
all the resources (jpeg images, svg drawings,...) that it uses.  This 
is great, works fine and is future-proof. But I do not want to look 
at a document by typing (or linking) to, say,

   .../A long document name/ A long document name.html

but just by

   .../A long document name/

Hence the rewrite rule: it takes the directory name and makes the 
html name from it.

I also always want the html file to be the first in the directory 
listing when I look at the folder in the file system, and have the 
resources follow later in the list, rather than having to hunt for 
the file amidst loads of resources.  Hence the leading space.
It really works like a dream!

The question I posed was:

If there is no html file in a directory (at least not one that 
corresponds to the name of the directory), then I want just the 
directory listing.  And it is that which does not seem to work.  The 
behaviour I am after is simple:

(1) find the html file that corresponds to the requested directory 
name and display that,
(2) if it does not exist, display the directory listing instead.

(1) works perfectly, it's when it fails that I do not get (2).

I'm running on Snow Leopard, and in fact I do have Apache version 
2.2.22 built 12 July 2012, sorry about the wrong version number.  But 
I don't think that matters to the problem.

When the rewrite rule fails, I want to get the index.  I would be 
surprised if there were no way of telling the server to just get on 
with Option +Indexes in case the rule fails.  But I did not find out 
how...

>         Options +Indexes
>
>I'd humbly suggest however that you try to avoid filenames with leading
>spaces.  As you are new to it, it is also worth pointing out that Apache
>2.0 is deprecated in favour of 2.2 or 2.4.

Yes, right, so I was wrong about my server's version number.

Best,
Robert.




--
View this message in context: http://apache-http-server.18135.x6.nabble.com/option-indexes-and-rewrite-tp5005951p5005954.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.