我在让 PHP 脚本在新服务器上工作时遇到了一些问题——我已经从 apache 转到了 Litespeed 服务器,但我无法让小 CMS 在上面工作。
简而言之,.htaccess 包含:
ServerName www.domain.co.uk
ServerAlias domain.co.uk
DocumentRoot /home/domain/public_html/
<Directory /home/ttedomainpublic_html/>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.co.uk [NC]
RewriteRule ^(.*)$ index.php [L]
RewriteRule ^(.*) http://www.domain.co.uk/$1 [L,R=301]
RewriteBase /
RewriteRule ^(admin|content|css|images|img|non_public|pdf|renderers|scripts|sendmail|templates) - [L]
</Directory>
index.php 包含:
<?php
include("non_public/config.php");
// Get the request URI
$requestUri = $_SERVER['REQUEST_URI'];
$requestUri = preg_replace("~^/~","",$requestUri);
$requestUri = str_replace("/","_",$requestUri);
// Make sure that we'll get the index
if(empty($requestUri)) $requestUri = "index";
if(file_exists(ROOT_PATH . "content/" . $requestUri))
{
// Include the header
include(ROOT_PATH . "templates/header.php");
// Check if there's a renderer
if(file_exists(ROOT_PATH . "renderers/" . $requestUri . ".php"))
{
include(ROOT_PATH . "renderers/" . $requestUri . ".php");
}
else
echo file_get_contents(ROOT_PATH . "content/" . $requestUri);
// Include the footer
include(ROOT_PATH . "templates/footer.php");
}
else
echo file_get_contents(ROOT_PATH . "content/404");
?>
因此,以上内容应该从content/中保存的内容文件、模板中的一些位和 bobs 以及renderers/目录中的一些基本内容组合在一起。
我希望到目前为止这有意义吗?几年来,这在 Apache 服务器上运行良好,但在 Litespeed 下无法运行。当前访问www.domain.co.uk/notes时的最终结果只是一个 404 页面,因为显然www.domain.co.uk/notes/index.php等不存在并且服务器不能似乎把页面放在一起。
谁能指出我正确的方向?
非常感谢...