dimanche 7 août 2016

How to route assets files located parent to the public directory

I code my simple framework (like CI, SMVC). I'm decided to place application folder above public_html folder.

Folder structure:

  • app
    • controllers
    • models
    • templates
    • views
    • boot.php
    • router.php
  • public_html
    • index.php
    • .htaccess
  • vendor
  • config.php
  • composer.json

This way give more security for site, because app placed above public_html and cannot be accessed directly, in public_html placed single entry point - index.php and many framework use this architecture.

But I want understand, how I can route (give to browser) links to js/css/img files, if they are placed above public_html folder (CSS, JavaScript, img in /app/templates or some composer projects in /vendor).

I know, big frameworks have solutions (via router) for this problem, but the code is difficult for me to understand.




Aucun commentaire:

Enregistrer un commentaire