I want to hide my website structure and redirect all possible requests to one file (index.php) with .htaccess.
Right now I use .htaccess to deny permission to read images and directories and redirect requests to index.php. If anybody requests forbidden dir/file, it shows E403. I want to redirect the request to index.php in that case, no E403.
So basically: I want to start processing every possible request (existing/non-existing page, .php file, image, other file, dir..., except css and js) in a single file (index.php), no matter what, so the user will see my index.php content every time (generated from many files on server side, depending on URI). My .htaccess can hide image content, but not the structure and PHP files. If anybody requests invalid URI, it's working (index.php shows error message), but if somebody requests for an existing PHP, it's executing it.
Order allow,deny
Deny from all
</Files>
<FilesMatch "\.(log|jpg|png|jpeg|gif|ico|jfif|pdf|phtml)$">
Order allow,deny
Deny from all
</FilesMatch>
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(css|js)$ index.php [L]
AddType application/x-httpd-php .php .phtml