Ubuntu 14
I get this error when i try to access index.php
The requested URL /main was not found on this server.
My .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
and the index.php starts like this:
<?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());
}
and the part of main
switch ($_GET['page']) {
case 'main':
$page = getTemplate('main.tpl', array('user'=>$user));
echo $page;
break;
On VPS with freshly installed LAMP.