Can you change the DirectoryIndex of specific directories?

Sé que puedes usar DirectoryIndex example.html in .htaccess, but what I need is to change the index for specific directories, like so:

DirectoryIndex /ex/index_file.html

or

DirectoryIndex /ex2/index_file2.html

Is there a way that you can accomplish this? I don't want to rename the file I'm trying to do this for to index.html because that's not what it is. You are required to login first, and if you're not it will redirect you; but I think that looks sloppy.

preguntado el 29 de julio de 12 a las 07:07

I mean like, say I have 2 separate directories. dir1 y dir2. For dir1 I want the DirectoryIndex to be example.html y para dir2 I want the DirectoryIndex to be another_example.html. ¿Eso ayuda? -

Oh got it I guess you can read the answer down there, I guess it should solve -

1 Respuestas

You can create an .htaccess in each directory that you want a different directory index in. The .htaccess in the ex directorio debe contener:

DirectoryIndex index_file.html

But the on in ex2 debería contener:

DirectoryIndex index_file2.html

También puedes usar <Directory> in the .htaccess in your web root as long as you are allowed to override this:

<Directory ex>
   DirectoryIndex index_file.html
</Directory>

<Directory ex2>
    DirectoryIndex index_file2.html
</Directory>

Respondido 29 Jul 12, 08:07

This solved my question. :) I thought you might be able to do that, I guess I should've tried before posting the questions; oh well. Thanks for the help! - mate talley

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.