包含现有文件会产生WordPress的404页面

时间:2012-05-24 21:26:59

标签: php wordpress http-status-code-404

我有一个在WordPress上运行的网站。在这个站点的文档根目录中,我有一个目录,我在其中测试与我的WordPress安装无关的PHP脚本。我注意到,每当我需要或包含一个确实存在的文件时,我得到一个404.如果我注释掉require语句,一切都很好。起初,这是因为语法错误。但我清理了它,不再在error_log文件中获取任何内容。是什么给了什么?

编辑:在我的主要error_log中找到了这个:malformed header from script. Bad header=X-UA-Compatible: ide.php。我在其他Apache服务器上从未遇到过这方面的问题。

以下是违规脚本:

ide.php

<?php

require_once 'config.php';

if (isset($_SESSION['username'])) {
    if (isset($_POST['command'])) {
        if ($_POST['session'] == '@') {
            session_destroy();
            header('Location: /area51/ide.php');
        } else {
            echo 'None';
        }
    } else {
        $smarty->assign('version', shell_exec("/home1/tylercro/local/python3/bin/python3 -c \"import sys;print('Python', sys.version)\""));
        $smarty->display('ide.tpl');
    }
} else {
    if (isset($_POST['username']) && isset($_POST['password'])) {
        if ($_POST['username'] == 'user' && $_POST['password'] == 'password') {
            $_SESSION['username'] = $_POST['username'];
        }
        header('Location: /area51/ide.php');
    } else {
        $smarty->display('ide-login.tpl');
    }
}

?>

的config.php

<?php

error_reporting(E_ALL);

session_start();

if (!headers_sent()) {
    header('X-UA-Compatible: chrome=1');
    header('Content-Type: text/html; charset=UTF-8');
}

require_once 'Smarty-3.1.8/Smarty.class.php';

$smarty = new Smarty();
$smarty->setTemplateDir('Smarty-3.1.8/templates/');
$smarty->setCompileDir('Smarty-3.1.8/templates_c/');
$smarty->setCacheDir('Smarty-3.1.8/cache/');
$smarty->setConfigDir('Smarty-3.1.8/configs/');

?>

1 个答案:

答案 0 :(得分:0)

这是一个标题问题。我发送的标题中有一些语法错误。

相关问题