Jump to content

Recommended Posts



Of all the things I know about htaccess, this is my most probalmatic one.


Basically, my domain when acccessed is www.**** which has the index.html file as its first file.


However, i want to change this to be say indexa.html


Now, i need to use .htaccess to do this, because I am working on an upgrade and hence i need the index.html page still to be present but accessible yet not the default page.


However, if I use DirectoryIndex indexa.html, all the folders below the main root change to this too. How can i set it for only the top folder?



Link to post
Share on other sites

DirectoryIndex allows multiple arguments - if it can't find the first one you specify, it looks for the second.


Making the .htaccess in the website root say:


>DirectoryIndex indexa.html index.html


Will tell it to FIRST look for a file called indexa.html, and then if it can't find one, look for index.html.


This should solve your problem as long as there are no indexa.html's in your subdirs.

Link to post
Share on other sites
  • 1 month later...

snipe, thank your for helping me (indirectly) with the .htaccess "DirectoryIndex"


This works great as a internal redirector.


I needed www.**** to go to www.****/store/index.php


I used

>DirectoryIndex /store/index.php


This worked perfectly!


Hopes this helps others

Link to post
Share on other sites

I'm glad it's working for you. Just wanted to throw in that when I do that kind of thing I just rename my stable file to index.html and work on indexa.html. I can go to the test version in the URL and it doesn't break anyone else coming to my site.


Just a though.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...