httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Cailliau <>
Subject [users@httpd] option indexes and rewrite
Date Sat, 25 May 2013 15:06:38 GMT
I'm new to httpd.conf (apache 2.0)
I want the server to respond in one of two ways to a request that looks like
a directory.
e.g. if the request is *http://localhost/a/b/c/*
then: (1) if a file with name "* c-en.html*" exists inside directory *c*,
then it should serve that,
(2) if that file does not exist, it should serve the directory listing of
directory *c*.
(note the space in front of  c-en.html, but I don't think it's relevant)

I wrote:

	RewriteEngine on
	RewriteCond /$1/$2/\ $2-en.html !-f
	RewriteRule ^(.*)/([a-z|A-Z|0-9|-|\ ]+)/?$ $1/$2/\ $2-en.html [L]

	Options Indexes

but either the rewrite rule works or the indexes work, but not the second if
the first fails.
I also do not understand:
(a) why I need to use !-f instead of just -f.
(b) why I need a / to start the RewriteCond.
Thanks for any help.

View this message in context:
Sent from the Apache HTTP Server - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message