I have folders: app , core , files . The MVC application is stored in the app, the core in the core , and the files all user files and folders. I am developing my system and I need to do the following:

  1. All requests to forward to /index.php
  2. Issue 403 to all root folders so that the user cannot enter them.
  3. When accessing the file in /files/* issue the file.

That is, now there is a problem in that when referring to any folder its structure is shown. The second problem is that if you create a FilesController controller and access it /files/ , then the folder is shown, but the controller is not running.

I tried this:

 AddDefaultCharset UTF-8 #Options +FollowSymLinks #IndexIgnore */* RewriteEngine On #RewriteCond %{REQUEST_URI} ^/files/ #RewriteRule ^assets/(.*)$ /files/assets/$1 [L] #RewriteRule ^css/(.*)$ /files/assets/css/$1 [L] #RewriteRule ^js/(.*)$ /files/assets/js/$1 [L] #RewriteRule ^images/(.*)$ /files/assets/images/$1 [L] #RewriteRule .* index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L] 

UPD . The question of closing access to the app and core did like this:

 RewriteEngine On RewriteRule ^(?:app|core)\b.* index.php [F] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [PT] 

I don’t know how to do this with files yet. I have a files folder and the controller is the same. How do you differentiate them?

  • Simply put: accessed the file in files/* - issued the file. Turned to any folder - 403, turned to the controller - showed the result. Here's how to do it? - mepihindeveloper 1:58 pm
  • Use a router with the redirection of all requests for the index file - Slava

0