index.htm and index.php in same directory?

Discussion in 'Site & Server Administration' started by Ghalt, Dec 11, 2007.

  1. #1
    I have a website that is established, but want to convert to a blog.

    I've installed Wordpress into the root of the directory.

    Wordpress, of course, relies on index.php. My main page of my site uses index.htm

    I want to have users see the .htm file when they arrive at my site (it's name-branded and many people type it in directly to arrive there).

    But Wordpress seems to be a little fussy about me simply re-naming the index.php file (to something like wpindex.php).

    So, my question is: is there a way to configure my site (maybe through .htaccess?) to, by default, display index.htm even though index.php is on the same root? And if so, will the index.php still function correctly if I specify it in the URL? (ie: type out the whole path/index.php)

    Thanks!
     
    Ghalt, Dec 11, 2007 IP
  2. Ghalt

    Ghalt Peon

    Messages:
    182
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    nevermind.

    after some research it looks like that was too much of a pain.

    I uninstalled WP and reinstalled into a subdirectory. I'll build it out there and then move it when the time is right.
     
    Ghalt, Dec 11, 2007 IP
  3. M.W.S.

    M.W.S. Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ghalt
    Actually, you could do this with .htaccess easilly:

    DirectoryIndex index.html index.htm index.php
    Code (markup):
    So here first index.html is loaded, then index.htm and only after that - index.php. You can set whatever you want as an index page too by replacing names above :)
     
    M.W.S., Dec 12, 2007 IP
  4. MayurGondaliya

    MayurGondaliya Well-Known Member

    Messages:
    1,233
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    170
    #4
    You can set the priority of the index page by writing the below line in the .htaccess file.

    DirectoryIndex index.htm index.html default.htm index.php index.php3

    Apache will look for each of the above files in order and serve the first one it finds when a visitor requests just a directory. If the webserver finds no files in the current directory that match names in the DirectoryIndex directive then a directory listing will be displayed to the browser showing all files in the current directory.
     
    MayurGondaliya, Dec 12, 2007 IP