# BEGIN SelfOrganization clean URLs
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^ - [E=SELFORG_CLEAN_URLS:1]
RewriteRule (^|/)\.(?!well-known(/|$)) - [F,L]
RewriteRule ^(config|classes|includes|storage|templates)(/|$) - [F,L]
<IfModule mod_headers.c>
Header set X-Content-Type-Options "nosniff"
</IfModule>
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
RewriteCond %{REQUEST_URI} !/(api|cron)/
RewriteCond %{THE_REQUEST} ^[A-Z]+\s/+((?:[^?\s]*/)?)index\.php[?\s]
RewriteRule ^ /%1 [R=301,L,NE]
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
RewriteCond %{REQUEST_URI} !/(api|cron)/
RewriteCond %{THE_REQUEST} ^[A-Z]+\s/+([^?\s]+)\.php[?\s]
RewriteRule ^ /%1 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
</IfModule>
# END SelfOrganization clean URLs
