Where Do I put uploaded website files

Hello,
I understand that website files are supposed to be in public folder.

Here is the file index.php :slight_smile:

<?php
require "pages/page_header.php";
require "pages/index.inc.php";
require "pages/page_footer.php";
?>

is it correct to put index.php in public folder and the included files in pages folder outside public folder for security or I doesn’t work this way?

It’s best to put the PHP include files somewhere they are not publicly accessible.
In you index, the path shows a pages folder within the public root folder. That can work, but you probably want to protect that folder from public access which can be done via a config file (such as htaccess in Apache).
Though I prefer to put includes in a private folder below the public root. If you do that, you will need to alter the paths in your index to suit.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.