找不到请求的URL / main

时间:2016-05-10 12:08:09

标签: php

Ubuntu 14

当我尝试访问index.php

时出现此错误
  

在此服务器上找不到请求的URL / main。

我的.htaccess

RewriteEngine on
RewriteRule ^(\w+)$ index.php?page=$1 [L,NC,QSA]
RewriteRule ^(\w+)+\/$ index.php?page=$1 [L,NC,QSA]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
order allow,deny
allow from all

并且index.php像这样开始:

<?php
if (!isset($_GET['page'])) {
     header('Location: /main');
exit();
}

ini_set('display_errors','Off');
try {
     $db = new PDO('mysql:host=localhost;dbname=xxx', 'xxx', 'xxx', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
} catch (PDOException $e) {
exit($e->getMessage());
}

和主要部分

 switch ($_GET['page']) {
case 'main':
    $page = getTemplate('main.tpl', array('user'=>$user));
    echo $page;
    break;

使用新安装的LAMP进行VPS。

0 个答案:

没有答案