Php web项目的htaccess和文件结构

Php web项目的htaccess和文件结构,php,.htaccess,url,web,project,Php,.htaccess,Url,Web,Project,我的web项目中有以下结构: domain.com -index.php frontend .htaccess -index.php -home.php -404.php -new_site.php account -index.php -new_site.php backend -backendfi

我的web项目中有以下结构:

domain.com

    -index.php

    frontend

        .htaccess
        -index.php
        -home.php
        -404.php
        -new_site.php

        account

            -index.php
            -new_site.php

    backend

        -backendfiles.php
        -etc..
我的档案

domain.com/index.php:

include ( 'frontend/index.php' );
$str = $_GET[ 'values' ];
$str = str_replace( '../', '', $str );

$vars = explode( '/', $str );
$path = '';
foreach( $vars as $var ) {
    $p = strpos( $var, ':' );
    if( $p == 0  ) {
        $path .= $var . '/';
        continue;
    }
    $_GET[ sub_str( $var, 0, $p ) ] = sub_str( $var, $p + 1 );
}

if( $path ) {

     // File
     $file = $path . '.php';
     if( file_exists( $file ) ) {
         include( $file );
         exit;
     }

     // Direction
     $file = $path . '/index.php';
     if( file_exists( $file ) ) {
         include( $file );
         exit;
     }

     // Page not found
     // include( '404.php' );

}

// Default Page
include( 'home.php' );
domain.com/frontend/.htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?values=$1 [L]
</IfModule>
我试过的

当我打电话时:

domain.com
domain.com/new_site
domain.com/account
domain.com/account/new_site
=>从domain.com/frontend/home.php加载内容=>有效

当我打电话时:

domain.com
domain.com/new_site
domain.com/account
domain.com/account/new_site
=>从domain.com/frontend/new_site.php加载内容=>不起作用

当我打电话时:

domain.com
domain.com/new_site
domain.com/account
domain.com/account/new_site
=>从domain.com/frontend/account/index.php加载内容=>不起作用

当我打电话时:

domain.com
domain.com/new_site
domain.com/account
domain.com/account/new_site
=>从domain.com/frontend/account/new_site.php加载内容=>不起作用

有人能帮我吗

我的结构好还是应该改变


问候和感谢

“不工作”-它是否产生任何错误?这正是我得到的:未找到此服务器上未找到请求的URL/帐户。是否尝试调试index.php?尝试回显(不包括),你会发现问题出在哪里。你所说的“回显”是什么意思?你能用代码解释一下吗?抱歉,但如果你不知道如何在PHP中响应某些东西,你应该从阅读手册开始,而不是从编写代码开始。