Thank you very much! I will look into that. 
 

 




On Thu, 12 May 2016 12:54:02 +0200
Erling Westenvik <erling.westen...@gmail.com> wrote:

On Thu, May 12, 2016 at 10:18:09AM +0000, Romain wrote:
> Allright. 
> Thanks for your answer. 

Have a look at this thread: https://github.com/reyk/httpd/issues/27

And my example would probably be better this way:

<?php
    if (basename($_SERVER["PHP_SELF"]) == "index.php") {
        if (file_exists($_SERVER["DOCUMENT_ROOT"]
                       .$_SERVER["REQUEST_URI"]
                       ."index.html")) {
            header("Location: ".$_SERVER["REQUEST_URI"]."index.html");
        }
    }
?>

> On Thu, 12 May 2016 11:40:10 +0200
> Erling Westenvik <erling.westen...@gmail.com> wrote:
> 
> 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

Reply via email to