Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

linking issue WordPress


after moving my index file out of a subdirectory to publish the site to the main root url, a link was disrupted. The interrupted link is the one to the "Register" page. The URL of that registration page is

Error message:
Warning: require(./main/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/content/76/7670676/html/main/index.php on line 17

Fatal error: require() [function.require]: Failed opening required './main/wp-blog-header.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/76/7670676/html/main/index.php on line 17

Code to change:
<?php // if user is not logged in

if ( !is_user_logged_in() ) {

// concatenate HTML
$html = '';
$html .= '<div class="text">';
$html .= '<h1>' . get_the_title() . '</h1>'; // post title
$html .= '<p class="notice">';
$html .= 'You have to be logged in to view this page. If you\'re a member, your email address is your Username. It\'s FREE, so please ' . wp_register('', '', false) . ' if you\'re not a member yet.';
$html .= '</p>';
$html .= wp_login_form( array( 'echo' => false ) ); // login form, which by default will redirect back to the current page
$html .= '</div>';

// print HTML
echo $html;

// if user is logged in, just go on as usual
} else {

Answers (1)


Dan | gteh answers:

Edit your index file that you moved and look for:

and change it to

Patrick MacAdams comments:

If I do that, then the site, which is hosted in a sub directory, won't be found.

Dan | gteh comments:

where is the main index file now and where are you trying to move it to?

Patrick MacAdams comments:

the index file is in the root directory. i'm not trying to move it. it's referencing my WP installation in the folder called 'main'.

Dan | gteh comments:

There are 2 index files though. one in your main root folder that I guess is calling wordpress, and then one in your /main/ folder.

The one in your /main/ folder is trying to call ./main/wp-blog-header.php

You would need to edit the /main/index.php file and remove ./main from the include

Dan | gteh comments:

If you want to, send me a private message here with some temp FTP details and I can take a look.