0

Months ago, I have placed a 301 redirect rule in my .htaccess file to redirect all the www request to a non-www request.

The problem is two days ago, when I tried to access my example.net site using www.example.net I get the following warnings in the page and website is not loaded.

https://i.stack.imgur.com/nXBMF.png

Here are the corresponding lines:

1. Plugin.php Line 647 = if ( strpos( $file, $realdir ) === 0 ){

Full function:

/**
 * Gets the basename of a plugin.
 *
 * This method extracts the name of a plugin from its filename.
 *
 * @since 1.5.0
 *
 * @param string $file The filename of plugin.
 * @return string The name of a plugin.
 */
function plugin_basename( $file ) {
    global $wp_plugin_paths;

    foreach ( $wp_plugin_paths as $dir => $realdir ) {
        if ( strpos( $file, $realdir ) === 0 ) { /** LINE 646 */
            $file = $dir . substr( $file, strlen( $realdir ) );
        }
    }

    $file = wp_normalize_path( $file );
    $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
    $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );

    $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
    $file = trim($file, '/');
    return $file;
}

2. Pluggable.php Line 1178 = header("Location: $location", true, $status);

Full file: http://pastebin.com/0zMJZxV0

I use WordPress only to write some articles. My PHP knowledge is very basic and limited only to locate errors.

Please help me figure out the problem with this. As I have read from the Codex FAQ, they say that empty strings may be a culprit for the pluggable.php error. But I have no idea how to locate it and I have attached the file for your reference.

Please provide your suggestions to avoid this error in the future. Thanks in advance.

3. EDIT - wp setting file: (the error line - include_once( $plugin ); )

// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
    wp_register_plugin_realpath( $plugin );
    include_once( $plugin );
}
unset( $plugin );
halfer
  • 19,824
  • 17
  • 99
  • 186
  • possible duplicate of [How to fix "Headers already sent" error in PHP](http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) – rnevius Feb 12 '15 at 09:43
  • I have tried finding that BOM issue. But my files are in perfect shape. – TrisssjjaS Feb 12 '15 at 10:05
  • You're not understanding...that's the ONLY thing it could be. Look in plugins as well. – rnevius Feb 12 '15 at 10:30
  • I looked at all the PHP files in my plugin folder. There are no empty spaces before are after the PHP tags. – TrisssjjaS Feb 12 '15 at 10:45

2 Answers2

0

The issue with the header information has been discussed in here: Cannot modify header information error in Wordpress. Could you give this a try and see whether this solves this part of your problem?.

On the other issue: try var_dump ($file) (for instance -- or echo $file ) to see what they actually contain.

Community
  • 1
  • 1
0

Check your configuration path of plugins :

var_dump($wp_plugin_paths);

You've got an error because $realdir is empty.

Bang
  • 919
  • 4
  • 11