Options -Indexes
Options -Multiviews
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# redirect all requests that were not found to index.php and set the original request in GET['__or__']
# avoid folders that should not be requested, and folders where you place your files
# this is better than avoiding by extension
RewriteCond %{REQUEST_URI} !^code.*$ [NC]
RewriteCond %{REQUEST_URI} !^files.*$ [NC]
# make sure files that are not found do not end up being processed by PHP
RewriteCond %{REQUEST_URI} !.(gif|jpg|jpeg|png|js|css)$
RewriteRule ^(.*)$ index.php?__or__=$1 [L,QSA]
# in CGI mode we need to get the AUTHORIZATION headers for PHP
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]