WordPress.org

Ready to get started?Download WordPress

Forums

Easy way to make index.php your homepage WP1.5 (19 posts)

  1. joeking
    Member
    Posted 9 years ago #

    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?

  2. dryan
    Member
    Posted 9 years ago #

    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

  3. joeking
    Member
    Posted 9 years ago #

    Thanks Dryan :-)

    Is there an alternative to a redirect?

    George

  4. Mark (podz)
    Support Maven
    Posted 9 years ago #

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

  5. joeking
    Member
    Posted 9 years ago #

    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

  6. Mark (podz)
    Support Maven
    Posted 9 years ago #

    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');

  7. joeking
    Member
    Posted 9 years ago #

    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?

  8. joeking
    Member
    Posted 9 years ago #

    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 . . .

  9. sirjonathan
    Member
    Posted 9 years ago #

    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

  10. joeking
    Member
    Posted 9 years ago #

    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 :-(

  11. joeking
    Member
    Posted 9 years ago #

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

  12. joeking
    Member
    Posted 9 years ago #

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

  13. joeking
    Member
    Posted 9 years ago #

    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 :-(

  14. joeking
    Member
    Posted 9 years ago #

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

  15. joeking
    Member
    Posted 9 years ago #

    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?

  16. joeking
    Member
    Posted 9 years ago #

    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 :-)

  17. joeking
    Member
    Posted 9 years ago #

    Okay, Jonathan's advice re where the images were pointing to was the key to images. So I moved wp-impages directory to the root and I'm good to go!

    Yeehah!

    Sorry for posting what may be obvious to many, but I thought it might just help someone like me who tries to do the same thing :-)

  18. sirjonathan
    Member
    Posted 9 years ago #

    Glad to see things are going good for ya! Keep at it bro you're getting it! :D

    -Jonathan

  19. rowby
    Member
    Posted 9 years ago #

    Thanks. That easy code worked for me too. I was digging all over the place until your ez-fix gave replaced my old http://www.rowby.com/index.html with http://www.rowby.com/index.php -- flawlessly mirroring my .www.rowby.com/wordpress/index.php in real time.

    As others have mentioned here, the main thing to do is make sure your images are appropriately referenced to the correct directories. In my case I just make sure all images in my somewhat simple blog are have the full url, starting with http://

    Rowby

    http://www.rowby.com

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.