Plik index.php wygląda nastepująco:
  1. if (!isset($_GET['page'])) {
  2. header('Location: /main');
  3. exit();
  4. }
  5.  
  6. ini_set('display_errors','Off');
  7. try {
  8. $db = new PDO('mysql:host=localhost;dbname=xxx', 'xxx', xxxx', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
  9. } catch (PDOException $e) {
  10. exit($e->getMessage());
  11. }
  12.  
  13. if (isset($_COOKIE['hash'])) {
  14. $sql = $db->query("SELECT * FROM `users` WHERE `hash` = " . $db->quote($_COOKIE['hash']));
  15. if ($sql->rowCount() != 0) {
  16. $row = $sql->fetch();
  17. $user = $row;
  18. }
  19. }
  20.  
  21. $min = 150;
  22. $ip = 'localhost';
  23. $referal_summa = 20;
  24.  
  25. switch ($_GET['page']) {
  26. case 'main':
  27. $page = getTemplate('main.tpl', array('user'=>$user));
  28. echo $page;
  29. break;
  30.  
  31. case 'deposit':
  32. $page = getTemplate('deposit.tpl', array('user'=>$user));
  33. echo $page;
  34. break;



W katalogu "template" są pliki: main.tpl oraz deposit.tpl

Plik .htaccess wygląda następująco:
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
deny from 46.101.200.204
allow from all



Na localhoscie na xamppie działa bardzo dobrze.

Natomiast na VPS ubuntu 14 jest problem z wyświetlniem strony.
Z automatu ładuje się adres: ip_maszyny/main
ale jest tylko kod błędu : 404

Na VPS jest
apache, php, mysql, phpmyadmin

Konfiguracja /etc/apache2/apache2.conf


<Directory /var/www/html/>
Options Indexes FollowSymLinks Multiviews
Order allow,deny
allow from all
AllowOverride None
Require all granted
</Directory>


Konfiguracja /etc/apache2/site-available/000-default.conf


<VirtualHost *:80>
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>