Wordpress: index.html vs. index.php

binarysoulbinarysoul Member Posts: 993
Most web hosting companies want you to place index.html in your web directory as default so it brings up your domain.

Given wordpress uses index.php, how can you make a Wordpress blog become the default page of a domain?

Comments

  • royalroyal Member Posts: 3,352 ■■■■□□□□□□
    I use hostmonster.com. My wordpress default page is index.php and loads just fine. Also, the reason this works is the Wordpress installation modifies your htaccess file with:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    So basically your web server will load index.php.
    “For success, attitude is equally as important as ability.” - Harry F. Banks
  • darkerosxxdarkerosxx Banned Posts: 1,343
    Web servers have that setting in the configuration as to which types of extensions are allowed to be indexes.

    If you don't have any other index files, just leave the index.php there and see if it works.

    If you've already done that and it doesn't work, it's likely that your provider doesn't have .php allowed as an index extension type.

    If you want to have other index files in the same directory, have your provider only allow .php as an index extension type.


    Aside from all of that, you could place a index.html page and include a redirect to index.php.
  • tierstentiersten Member Posts: 4,505
    Most will search for them in turn. index.html is usually first. If it can't find that then it'll pick .php or .asp or whatever based on whatever language the server knows.
  • binarysoulbinarysoul Member Posts: 993
    I know for a fact the provider only allow index.htm or index.html, so no php. I may go after them to see if they can help.

    I like the redirection idea, but I think visitors will may not like that, or is the process transparent to the visitor?
  • tierstentiersten Member Posts: 4,505
    binarysoul wrote:
    I know for a fact the provider only allow index.htm or index.html, so no php. I may go after them to see if they can help.
    They don't allow you to have index.php but they support PHP? Bit strange.
    binarysoul wrote:
    I like the redirection idea, but I think visitors will may not like that, or is the process transparent to the visitor?
    No. It won't be transparent since you'll only be able to do a meta refresh. You can't send a 302 response back to bounce them somewhere else.
  • dynamikdynamik Banned Posts: 12,312 ■■■■■■■■■□
    Might want to find a new web host. I'm not sure how obvious a meta refresh would be to most people. You could also throw onload="window.location='index.php'" in the <body> tag. (Still include the meta refresh in case JS is disabled.)
Sign In or Register to comment.