Sorry about the absence of code, didn't want to wall-o-text. I changed my folder structure around, I had apps and public under a 'dashboard' folder, like this:
/var
/www
/html
/dashboard
/apps
/public
index.php
It is now:
/var
/www
/html
/apps
/public
index.php
Where index.php, the bootstrap, is under /public, like the tutorial says.
Contents of bootstrap:
use Phalcon\Loader;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Application;
use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\Url as UrlProvider;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
try {
// Register an autoloader
$loader = new Loader();
$loader->registerDirs(
[
'../app/controllers/',
'../app/models/',
]
);
$loader->register();
// Create a DI
$di = new FactoryDefault();
// Setup the view component
$di->set('view', function () {
$view = new View();
$view->setViewsDir('../app/views/');
return $view;
});
// Setup a base URI so that all generated URIs include it
$di->set('url', function () {
$url = new UrlProvider();
$url->setBaseUri('/');
return $url;
});
// Handle the request
$application = new Application($di);
$response = $application->handle();
$response->send();
//echo $application->handle()->getContent();
} catch (\Exception $e) {
echo "Exception: ", $e->getMessage();
}
It still loads the IndexController, but now it ONLY loads that one. If I surf to serverIP/user/list I get the main index page again. In fact anything I type in goes there.
I put this in my /etc/apache2/apache2.conf
<IfModule mod_rewrite.c>
<Directory "/var/www/html">
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule ((?s).*) public/$1 [L]
</Directory>
<Directory "/var/www/html/public">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=$1 [QSA,L]
</Directory>
</IfModule>
And I put this in my /etc/apache2/sites-available/000-default.conf
ServerAdmin [email protected]
DocumentRoot /var/www/html/public
DirectoryIndex index.php
<Directory "/var/www/html/public">
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory>
I'm a Windows networking guy, so all this linux/apache is killing me. :) It's like Kryptonite. But millions (ok, like 12 people) are counting on me...
Thanks for the help!