Jump to content

What does your directory structure look like?


cgm225

Recommended Posts

What does your directory structure look like for your applications?  Where do you put your config files, your media files (like photos, etc), etc?

 

I am curious what the best way to structure my web server directory is...

Link to comment
Share on other sites

I suppose the 'best' way is something that's rational with sensibly-named folders.

 

I usually have something like

. images (sometimes subfolders here depending on usage)

. support (for css, js files and db-conn file)

. includes (for files to be included)

. downloads (if applicable)

. admin (htpassword protected)

 

Link to comment
Share on other sites

The best structure is the one you can remember unless you want added security, for instance I usually always place my images in a folder called images which makes sense right however if you don't place an index file in this folder as well on some servers someone can type in mypage.com/images/ and see a full indexable list of all your sites images.

 

They can also hot-link to them but there are php tactics which you can use to get around that. For videos its not suggested you place them in a videos folder this folder should be much more complex like 55sdaf65as and a sub-folder in that folder called anything like 54sad564sad5f.

 

The reason I do this with videos is because when people want to hot-link to a video it really does a number on your bandwidth however if you have a flash player to play these videos you can code flash so that its pretty much impossible for the visitor to guess your document structure.

 

For secured and protected files you can always place them in a folder called secure or protected but the true security comes into place in your actual code to restrict access to these files.

 

Your document structure can be whatever makes sense to you but you also really need to think about security in your code to restrict access to your document structure.

Link to comment
Share on other sites

For my cms i have an index.php, init.php and config.php in the root. All other basic code is in the folder 'include' (database etc). Furthermore there are two folders 'plugins' and 'media'. Both are organized by plugin:

/plugin/blog/blog.class.php is the blog controller

/media/contact/form.php is the template for the contact form

 

I'd like to rewrite it soon to www and non-www. The non-www folder contains the models and controllers. The www folder contains all media files like images, templates, scripts and so on.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.