RewriteEngine On ## ## You may need to uncomment the following line for some hosting environments, ## if you have installed to a subdirectory, enter the name here also. ## RewriteBase /phpCourse/exam ## ## Black listed folders ## RewriteRule ^app/.* index.php [L,NC] RewriteRule ^config/.* index.php [L,NC] RewriteRule ^vendor/.* index.php [L,NC] RewriteRule ^routes/.* index.php [L,NC] RewriteRule ^pages/.* index.php [L,NC] ## ## White listed folders ## RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} !/api/docs/.* RewriteCond %{REQUEST_FILENAME} !/assets/.* RewriteRule !^index.php index.php [L,NC] ## ## Block all PHP files, except index ## RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} \.php$ RewriteRule !^index.php index.php [L,NC] ## ## Standard routes ## RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L]