ServerSignature Off

<IfModule mod_autoindex.c>
  Options -Indexes
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f

#  RewriteCond %{HTTPS} !=on
#  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # forbid access to packaged thalassa core directory
  RewriteRule ".*\.thalassa.*" - [F,L]

  # api endpoint
  RewriteRule "api/(.*)$"  "thalassa_api.php?endpoint=$1" [L]

  # basic endpoints
  RewriteRule "^$"  "thalassa_web.php?%{QUERY_STRING}" [L]
  RewriteRule "(home|sign_in|use_token|help|thalassa|feed|admin|store|change_pass|config|storage|initialize_database|sign_out|install)$"  "thalassa_web.php?endpoint=$1&%{QUERY_STRING}" [L]

  # search endpoint
  RewriteRule "search/?([0-9]+)?$"  "thalassa_web.php?endpoint=search&page=$1&%{QUERY_STRING}" [L]

  # view endpoint
  RewriteRule "view/(.+)$"  "thalassa_web.php?endpoint=view&file_id=$1&%{QUERY_STRING}" [L]

  # manage tags
  RewriteRule "tags$"  "thalassa_web.php?endpoint=tags&%{QUERY_STRING}" [L]

  # manage tokens
  RewriteRule "tokens/?(generate|name|set_mode|use|remove)?/?(.+)?$"  "thalassa_web.php?endpoint=tokens&$1=$2&%{QUERY_STRING}" [L]

  # custom pages
  RewriteRule "page/(.+)$"  "thalassa_web.php?endpoint=page&html_name=$1" [L]

  # your own custom rewrites
  #
</IfModule>

# disable caching for interpreted scripts
<FilesMatch "thalassa_.+\.php">
  FileETag None
  Header unset ETag
  Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
  Header set Pragma "no-cache"
  Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
</FilesMatch>

# additional content types
AddType image/webp webp
