WordPress.org

Support

Support » How-To and Troubleshooting » Easy way to make index.php your homepage WP1.5

Easy way to make index.php your homepage WP1.5

  • I’ve looked at some old posts about this, but all refer to earlier versions of WP.

    I’ve installed WP into a directory blog so at the moment to access it I go to:

    http://www.mydomain.com/blog

    I assume a lot of people must do it this way, but then want their homepage to be the blog’s index.php.

    So is there an easy way in 1.5 to achieve this?

Viewing 15 replies - 1 through 15 (of 18 total)
  • if you just want a redirect you can do it in an .htaccess file in your main folder

    just put

    DirectoryIndex ‘path/to.file’ (leave the ‘ ‘ out)

    in a plain text file and save it as .htaccess then load it in the main folder of your site

    Thanks Dryan 🙂

    Is there an alternative to a redirect?

    George

    Mark (podz)
    Support Maven

    @podz

    Why not put the wp root index.php in your webroot and inside that file alter the path to the file it calls ?

    Thanks Podz

    If I try this what would I need to do for example to:

    <?PHP get_header(); ?>

    How do I edit that to include the fact that it is not in the root alongside the index.php

    Mark (podz)
    Support Maven

    @podz

    That’s a function, not a file and you need to get the file that contains the function before you can get the function in the file

    🙂

    In a standard 1.5, the root index has this:
    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    ?>

    so it is looking for the file “wp-blog-header.php” in the same directory as where the index is.

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('wordpress/wp-blog-header.php');
    ?>

    It would look in the directory “wordpress” instead (it could be require(‘/wordpress/wp-blog-header.php’);

    Okay I’m now able to get my index.php to load as the main website homepage thanks to Podz’ coding above.

    Only problem is images that I’ve put in the http://www.domainname.com/blog/wp-images directory that should appear on the index page no longer want to appear – even if I change the code to blog/wp-images/image.jpg from wp-images/image.jpg.

    Any ideas?

    Can’t post a folow up to this – just get this error message

    Precondition Failed

    The precondition on the request for the URL /support/bb-post.php evaluated to false.

    Of course I could post this for some reason . . .

    sirjonathan
    Member

    @sirjonathan

    Hey Joe!

    I went through the same thing not too long ago :). View your image links when you’ve loaded up the page and see where they are actually pointing to.. PHP can mess up your directory structures with all of the “include” magic.

    I also wrote a tutorial that mayyy be helpful to ya:

    http://www.jonathanwold.com/tutorials/wordpress_integration/

    Hang in there bro! Its worth it 🙂

    -Jonathan

    Actually bigger problem now 🙁

    I tried to put everything back the way it was so my blog was now at /blog again. This was after trying to move my index.php to the root to make it the homepage.

    But now I get this error:

    Fatal error: Call to undefined function: get_header() . . .

    when before my index.php page would appear

    I’m using a theme and that’s where my index.php is, but I’ve also uploaded one to blog/index.php. Do I need both? I’m not sure if in my panic I uploaded one to the wrong place 🙁

    Fatal error: Call to undefined function: get_header() in

    / home / placeint / public_html / blog / index.php on line 1

    Sorry for the mess , but it woyuldn’t let me post the fatal error message in one post – I had to add spaces to the second line. It’s not my day 🙁

    Jonathan – many thanks for that link. I’ll look at it after something to eat.

    Fixed it!!!!!

    I uploaded the index.php that came with the original WP 5.1 to my blog directory and all is well again. I must have overwritten it in my panic with the index.php that lives in the theme folder.

    Why two index.phps anyway?

    Okay, I’m ready for another go at this.

    Anyone else trying this <b>read Podz post above properly</b>.

    I didn’t.

    He told me to move the WP root index.php and I just went ahead and started messing with the theme index.php. Hence all my problems.

    Actually I find most of my problems are because I don’t read the advice properly or assume a little change can’t possibly be the whole solution when often it is.

    Now onto Jonathan’s tutorial 🙂

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Easy way to make index.php your homepage WP1.5’ is closed to new replies.