• Resolved cokaigne

    (@cokaigne)


    I have been moving a site from HTML pages to WP blog format, and now am trying to move the WP site into “first place” on the server so it is the version seen by visitors.

    Up until now it has lurked in a folder off the root of the server (/WP). So, now that all is ready I want to make the blog appear when someone goes to the root of the website (in this case ihobo.com as opposed to ihobo.com/WP.

    I have done this before once, from scratch, for a new site but this is the first time I have tried to do this to a site that is already live.

    I followed the instructions on the Giving WP its own folder page, altered the options, copied the index.php to the root and edited it with the folder name etc etc.

    Now, when I view the site in its installation folder all is well, but if I try to go to the root I get 2 error messages:

    Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/.kesakin/ihobo/ihobo.com/WP/wp-content/themes/ihobo/index.php on line 3

    Fatal error: require() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/local/php5/lib/php’) in /home/.kesakin/ihobo/ihobo.com/WP/wp-content/themes/ihobo/index.php on line 3

    Can anyone help? It’s been maddening so far, but I know I have just done something slightly wrong, and I expect one of you will know ??

    Thanks in advance.

Viewing 11 replies - 1 through 11 (of 11 total)
  • It looks to me like you haven’t completed step 9 in the instructions. It should be:
    require(./WP/wp-blog-header.php)

    Thread Starter cokaigne

    (@cokaigne)

    Hi,
    Believe me, I have been over this several times, and now have a pile of hair next to me. I have definitely copied the index.php to the root and altered the text. I just copied this line from it via my ftp prog:

    require('./WP/wp-blog-header.php');

    I am starting to wonder if it’s a hosting issue – though I have another site on the same host (same diskspace allocation, same server etc) with the same set up that works.

    I was going by the error message you quoted.

    Please could you post your /index.php and /WP/index.php and also the first few lines of /WP/wp-content/themes/ihobo/index.php

    Thread Starter cokaigne

    (@cokaigne)

    I can appreciate that ?? This is why I am going nuts…

    /index.php:

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

    /WP/index.php:

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

    first few lines of /WP/wp-content/themes/ihobo/index.php:

    <?php
    /* Don't remove this line. */
    require('./wp-blog-header.php');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">

    Thanks for your time, btw ??

    Is wp-blog-header.php still in your /WP folder?
    If so, you could try:

    require('WP/wp-blog-header.php');

    If not, then it’s:

    require('wp-blog-header.php');

    … and bear in mind that, on *nix servers, /WP is different from /wp.

    Thread Starter cokaigne

    (@cokaigne)

    Hi DianeV.

    My wp-blog-header.php (and all WP files) are in the /WP folder. I have set /index.php to say:
    require('WP/wp-blog-header.php');

    but no difference apparently, as I get the same error message. I have turned off caching as well, before someone asks ??

    It is a *nix server and the folder is definitely in caps.

    I suggest the following:
    /index.php:
    require('./WP/wp-blog-header.php')

    If you start with a “/” it means the root directory of the webserver, not your website! So you definitely need the dot to make it relative to the script.

    The line in /WP/index.php should be OK, or you could prefix it with ./

    The theme’s index.php looks a bit suspicious to me. I’m not familiar with that theme, but mine starts with get_header() not with the require statement.

    But seeing as it works for you if it’s installed in the top level of your site, I’d suggest changing this line to
    require('./WP/wp-blog-header.php')
    If that doesn’t work, try changing it to the absolute path:
    require('/home/.kesakin/ihobo/ihobo.com/WP/wp-blog-header.php')

    Thread Starter cokaigne

    (@cokaigne)

    jrawle gets the medal!

    The final suggestion of putting in the entire server path to the wp-blog-header.php in the index.php in my theme folder worked. I then had to add the path to the single.php and category.php in the theme folder too.

    There might be some more files that need the path adding, but I will find them as I check through the site.

    I’m sure something else is amiss somewhere to make me require this little fix, but nonetheless, the rest of my hair will hopefully stay in and the missing bits will grow back ??

    Thank you loads!

    I think the thing that is amiss is that you shouldn’t be “require”-ing that file from your theme templates. All of those pages are accessed through your blog’s main index.php, which has the “require” statement already. The templates should begin with the get_header() statement, which displays the header from your theme. I don’t think any files in your theme folder should be including wp-blog-header.php.

    The only time you need the require statement is in static PHP pages that aren’t part of WordPress, but in which you wish to use the WP theme.

    Did you write your theme yourself, and if so, did you base it on an existing theme?

    Try removing the “require” line from the theme files altogether, and see if it still works ??

    Thread Starter cokaigne

    (@cokaigne)

    I didn’t write the theme myself… I shall try removing the require line from the theme files and let you know how it goes.

    I’d do it now, but I’m also in the middle of moving house, so I have to type with arms between piles of stuff… It’s all a bit tricky ??

    Thread Starter cokaigne

    (@cokaigne)

    I took the require statement out of the themes, and that did the trick – it also made me spot a few other errors in the theme pages which are now corrected.

    Thanks for that!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘After moving WP to another folder…’ is closed to new replies.