How to arrange the website files properly?


I have a website with a db.
Yhere are a number of php file types

  1. files which work with the db like DB_connect.php, files whick add registering users, login process, inserting q extracting data to q from DB

  2. Files which are included in web pages like footer.php, page_header.php, page_content.php

3, web pages which are comprosed of the insluded php files like about.php, index.php, contact_us.php,signup.php,

How do I arrange them in the www folder ?

I put files of type 1 in a separated folder

I put the included files (type 2, in pages folder
I put the site web pages in the site filder where the index.php and the folders are

Is that correct logicaly ?
DO I mess things up this way ?

Optimally, you want everything outside of the www root that does not have to be there. Depending on your hosting you may or may not have access above the web root.

Additionally, an Architecture with a single point of entry is the way to go.

If you put your project on Github we can review it as a whole.

1 Like

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