In my own website, I try to refactor the folder structure of my webapps.
All files and folders as shown below are on the same server.
The desired structure is as follows:
my_webapps // Top level directory
apps/ // Subdir that holds the different web apps
app1/
public/
css/
js/
index.php
app/ // app internal src code
app2/
app3/
public/ // $_SERVER["DOCUMENT_ROOT"]
css/
js/
index.php // Entry point
views/
header.php
menu.php
The root index.php file lies in the top level public folder for security reasons. Looking at this answer that makes sense to me.
So in my "menu.php" (included in root index.php) I have some <a href="[link]">
tags to point to the URL of the different "apps/index.php" files.
But that does not work. The web server does not know the content in the "apps/" folder.
But how does this work with frameworks like Laravel then, like this post says?
Where is the mistake here and does anyone have an idea to solve this while still having the security benefits?
I am using nginx as a web server by the way. .htaccess is not an option.