部署PHP应用程序后路由不起作用

部署PHP后路由不起作用............................................ ................................................... ................................................... ................................................... .....................................

路由文件

$request = $_SERVER['REQUEST_URI'];

switch ($request) {
    case '/:1' :
        require __DIR__ . '\home.php';
        break;
    case '/' :
        require __DIR__ . '\home.php';
        break;
    case '' :
        require __DIR__ . '\home.php';
        break;
    case '/Career' :
        require __DIR__ . '\Career.php';
        break;
    case '/Terms':         
        require __DIR__ . '\Terms.php';
        break;
    case '/Press' :
        require __DIR__ . '\Press.php';
        break;
    case '/Media' :
        require __DIR__ . '\Media.php';
        break;
    case '/Feedback' :
        require __DIR__ . '\Feedback.php';
        break;
    case '/Support' :
        require __DIR__ . '\Support.php';
        break;
    case '/Privacy' :
        require __DIR__ . '\Privacy.php';
        break;
    case '/MediaKit' :
        require __DIR__ . '\MediaKit.php';
        break;
    case '/Article' :
        require __DIR__ . '\article.php';
        break;
    case '/FAQ' :
        require __DIR__ . '\Faq.php';
        break;
    case '/admin/' :
        require __DIR__ . '\admin\login.php';
        break;
    case '/admin' :
        require __DIR__ . '\admin\login.php';
        break;


    default:
        echo $request;
        http_response_code(404);
        require __DIR__ . '\error.html';
        break;
}
?>

.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
评论