I wish to move all files out of public folder except "index.php" & "assets." I'm slowly updating to a custom MVC for my small project: I've moved functions, config & classes etc. - it's just the old spaghetti PHP files left. I want to move them all before I start breaking them down into models, views etc.
I would prefer core PHP and not to use symfony if any one can help.
So, instead of all files been on same level as "index.php" everything would route to new folder with all the files and new "index2.php" - so I've used a simple way that works on some level but there are 30 files, and I do not wish to write each one out if there's a better way.
htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
index.php:
<?php
$request = $_SERVER['REQUEST_URI'];
switch ($request) {
case '/' :
require __DIR__ . '/app/memberlist.php';
break;
case '' :
require __DIR__ . '/app/memberlist.php';
break;
case '/staff' :
require __DIR__ . '/app/staff.php';
break;
default:
http_response_code(404);
require __DIR__ . 'app/pdointro.php';
break;
}
Also there are some paths in the file I don't know how to add like:
header("Location: account-details.php?id=$id");
and:
<a href='account.php?action=edit_settings&do=edit'>edit</a>