On Thu, May 12, 2016 at 12:04:50AM +0000, Romain wrote:
> Is it possible to supply multiple index files to the directory index
> directive? I mean, I would like to write something like that in
> httpd.conf:
>
> directory index "index.html" "index.php"
>
> which would mean that, if the directory contains "index.html", then
> the server should serve it first, if not, then try "index.php",
> otherwise the standard error.
Not that I'm aware of. Anyway: Such logic should be part of your
application, not the web server since it would just add unnecessary and
ambiguos complexity to the latter.
> Or should I do it in another way?
You could try something like this:
<?php
if (basename($_SERVER["PHP_SELF"]) == "index.php") {
header("Location: ".$_SERVER["REQUEST_URI"]."index.html");
}
?>
> Thanks.
> Best,
> Romain
Regards.
Erling