Support » Fixing WordPress » Index.html

  • Resolved cubells

    (@cubells)


    Hi:

    I have a index.html at my wordpress directory. This page is a frontpage that redirects my visitors to my blog.

    In wp versions lower than 2.7 my index.html and the wp index.php have lived together without any problem.

    In wp 2.7 it’s a problem my index.html. I have had to delete it.

    I have these options:
    wordpress address: http://www.my-site.com
    blog address: http://www.my-site.com/index.php

    When I visit my-site.com I go to my-site.com/index.html. Correct!

    But when I visit my-site.com/index.php I _always_ go to my-site.com/index.html. Incorrect!

    Any solution?

    A lot of thanks!

Viewing 15 replies - 16 through 30 (of 44 total)
  • kmessinger
    has the solution that everyone cheerfully ignores

    whooami

    (@whooami)

    Member

    indeed. and no surprise.

    mrmist

    (@mrmist)

    Forum Janitor

    For what it’s worth, this behaviour has changed between 2.6.5 and 2.7.

    With 2.6.5, you could have an index.html as the default page (/) for the directory, and WordPress would only load if you actually went to /index.php.

    The same is not the case in 2.7, and, as LiZharD is saying, you can no longer have that arrangement. (2.7 will always redirect /index.php to / which means you never see the blog)

    I am not sure if this is avoidable to be honest. It’s an odd setup.

    mrmist

    (@mrmist)

    Forum Janitor

    Thinking about it a bit more, you could potentially resolve it with some custom .htaccess rules that redirect visitors to / that are not being referred from local pages to /yourstartpage.html (renaming your index.html as yourstartpage.html) but that would also force any direct visitors through yourstartpage

    mrmist: 2.7 will always redirect /index.php to / which means you never see the blog

    which piece of code redirects /index.php to /?

    I’ll change it, because I’m not interested in this issue…

    Thanks!

    mrmist

    (@mrmist)

    Forum Janitor

    That I’m afraid I don’t know. You could try asking on the wp-hackers mailing list.

    chris

    (@christhomson)

    See changeset #9203. Replace the green code as seen in #9203 with the red code, in your /wp-includes/canonical.php file.

    It works!!

    A lot of thanks, ChirsThomson…

    Many thanks ChrisThomson.

    Chris, are you sure it’s replace the green with the red? Or is it replace the red with the green? I ask because the key says that the red is what’s removed and the green is what’s added.

    My text matches the green, but I am still experiencing the problem that mrmist explained above. (2.7 will always redirect /index.php to / )

    This behavior only started with the change to 2.7.

    Jeff

    chris

    (@christhomson)

    Yep — the green is the new code that was introduced into 2.7, which breaks the functionality you’re all used to. The red is the older code that allowed index.html files to work as you expect them to.

    Sorry, I couldn’t quite get it into my head that you were telling us to revert. Everything works fine now. Thanks.

    Jeff

    Chris, many thanks for your link to the changeset. I had a similar but slightly different problem, and undoing the 2.7 change restored the functionality I was used to.

    In my case, I have an index.php that is roughly like this:

    <?php
    $myhomepage=get_bloginfo('url') . '/'
    ?>
    <?php
    $mytarget="http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]
    ?>
    
    <?php if($myhomepage==$mytarget) : ?>
    ...display some selected posts as a home page
    <?php else : ?>
    ...display some different posts like a blog loop
    <?php endif; ?>

    That allowed me to have a home page of http://www.qbgarage.com and a blog loop of http://www.qbgarage.com/index.php

    #9203 broke that. Undoing it fixed it! Thanks.

    Cheers Chris. Your edit to restore the red code in changeset #9203 fixed it for me too.

    Never had this problem with WordPress before so glad of the fix 🙂

    Anyone wondering why I want to have index.php and index.html sitting together – I have an html holding page up, but still want to have WordPress sitting in the same directory whilst I populate it with content.

    I have a situation where I’m running .asp AND .php on the same server / same website.

    my website formerfatguy.com has been up since 1998 using microsoft active server pages.

    I’m now building a wordpress blog on top of it (and building it behind the scene as my .asp website is still functional)

    I have my .htaccess file set to default to index.asp as my default pages while I work on the new blog.

    To see my blog front page, I simply add index.php to my domain name and I can see what my front page looks like.

    after upgrading to 2.7, it re-directs automatically and I can no longer work on it. I’ll have to see if the suggested work around takes care of this for me in the mean time.

    what a pain

Viewing 15 replies - 16 through 30 (of 44 total)
  • The topic ‘Index.html’ is closed to new replies.