Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过htaccess和index.PHP使用url重写的我的PHP网站显示服务器500错误_Php_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

通过htaccess和index.PHP使用url重写的我的PHP网站显示服务器500错误

通过htaccess和index.PHP使用url重写的我的PHP网站显示服务器500错误,php,.htaccess,mod-rewrite,url-rewriting,Php,.htaccess,Mod Rewrite,Url Rewriting,我正在开发一个框架,在开发的过程中,我还在一个网站上实现它。 我的.htaccess Options +FollowSymlinks RewriteEngine on RewriteRule ^Themes/(.*)$ /qn_themes/$1 [R=301,NC,L] FallbackResource index.php 在index.php中,我管理路由 下面是index.php的内容 <?php include 'qn_config/conf.php'; //n

我正在开发一个框架,在开发的过程中,我还在一个网站上实现它。 我的.htaccess

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^Themes/(.*)$ /qn_themes/$1 [R=301,NC,L]
FallbackResource index.php
在index.php中,我管理路由 下面是index.php的内容

    <?php 
    include 'qn_config/conf.php'; //not important

    function getPath($elem)
    {
        if(! empty($elem[0]))
        {
            $theElem = array_shift($elem);
            return '/' . $theElem . getPath($elem);
        }
        else
        {
            return ".php";
        }

    }
    $page = 0;
    $path = ltrim($_SERVER['REQUEST_URI'], '/');    // Trim leading slash(es)
    $elements = explode('/', $path);                // Split path on slashes
    if(empty($elements[0])) {                       // No path elements means home
        $page = "Home";
    } 
    else
    {
        $page = array_shift($elements);
    }
    $path = 'qn_frontend/' . $page . getPath($elements);

    if (!file_exists($path)) {
        header("Location: " . $GLOBALS['host'] . '404');
    }
    include 'qn_themes/'. $currTheme.'/base.php' ;
?>

我不确定你的.htaccess与你的问题有什么关系。去掉index.php中的所有内容,并确保所有URL实际上都由index.php处理。否则,如果问题出现在PHP脚本中,您应该看到一条错误消息,而不是500个错误。根目录中没有404。404文件位于qn_前端文件夹中。所以,这也在这里处理。我不知道是什么原因造成的,所以我在这里发布了最多的信息。我还在网上试过,现在正在检查apache日志。如果您看到500错误,请打开“显示错误”或检查错误日志,以了解实际的错误消息。如何显示错误/打开错误报告:从错误日志中添加了错误,但我不知道这意味着什么。整个index.php都在这里,我似乎无法找出问题所在@马格纳斯·埃里克森解决了这个问题:毕竟这是一个htaccess问题。只需从错误日志中搜索错误,第一个就得到了答案。链接是我不确定你的.htaccess与你的问题有什么关系。去掉index.php中的所有内容,并确保所有URL实际上都由index.php处理。否则,如果问题出现在PHP脚本中,您应该看到一条错误消息,而不是500个错误。根目录中没有404。404文件位于qn_前端文件夹中。所以,这也在这里处理。我不知道是什么原因造成的,所以我在这里发布了最多的信息。我还在网上试过,现在正在检查apache日志。如果您看到500错误,请打开“显示错误”或检查错误日志,以了解实际的错误消息。如何显示错误/打开错误报告:从错误日志中添加了错误,但我不知道这意味着什么。整个index.php都在这里,我似乎无法找出问题所在@马格纳斯·埃里克森解决了这个问题:毕竟这是一个htaccess问题。只需从错误日志中搜索错误,第一个就得到了答案。链接是
<?php 
    include 'qn_config/conf.php';

    $path = ltrim($_SERVER['REQUEST_URI'], '/');    // Trim leading slash(es)
    $elements = explode('/', $path);                // Split path on slashes
    if(empty($elements[0])) {                       // No path elements means home
        $path = 'qn_frontend/Home.php';
    }
    else
        $path = 'qn_frontend/' . ltrim($_SERVER['REQUEST_URI'], '/') . '.php';

    if (!file_exists($path)) {
        header("Location: " . $GLOBALS['host'] . '404');
    }
    include 'qn_themes/'. $currTheme.'/base.php' ;
?>
[core:error] [pid 4943] [client 127.0.0.1:60258] AH00125: Request exceeded the limit of 10 subrequest nesting levels due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.