.htaccess 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Requires:
  2. # mod_cgi.c
  3. # mod_rewrite.c - only for legacy URL rediects
  4. # mandatory, already before first run of cgi (hopefully a webserver default or
  5. # uncomment and place .htaccess manually...):
  6. # AddHandler cgi-script .cgi
  7. # Options FollowSymLinks ExecCGI
  8. # mandatory
  9. DirectoryIndex index.html index.xml
  10. # recommended
  11. AddDefaultCharset UTF-8
  12. AddType application/javascript js jsonp
  13. AddType application/json json
  14. AddType image/svg+xml svg
  15. AddType text/css css
  16. AddType text/html html
  17. AddType text/xml xml xslt
  18. AddOutputFilter DEFLATE html xml xslt css js json svg
  19. ## if you had a previous shaarli and want the posting URLs to be permanent
  20. ## i.e. redirects from oldurl -> newurl:
  21. ##
  22. ## https://stackoverflow.com/questions/21062290/set-rewritebase-to-the-current-folder-path-dynamically/21063276#21063276
  23. #RewriteEngine On
  24. #RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
  25. #RewriteRule ^(.*)$ - [E=BASE:%1]
  26. #
  27. #ErrorDocument 404 %{ENV:BASE}themes/current/404.html
  28. #
  29. ## redirect cgi probe and legacy posting
  30. #RewriteCond %{QUERY_STRING} ^((.*&)?post=.*)$
  31. #RewriteRule ^/?$ %{ENV:BASE}shaarligo.cgi?%1 [redirect=301,last,qsdiscard]
  32. #
  33. ## legacy URLs https://perishablepress.com/redirect-query-string-htaccess/
  34. #RewriteCond %{QUERY_STRING} ^([0-9a-zA-Z_-]{6})$
  35. #RewriteRule ^/?$ %{ENV:BASE}shaarligo.cgi?%1 [redirect=301,last,qsdiscard]
  36. # recommended
  37. # http://www.golem.de/news/content-security-policy-schutz-vor-cross-site-scripting-1306-99795.html
  38. # http://www.w3.org/TR/CSP/#example-policies
  39. Header add Content-Security-Policy "default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self' 'sha256-hGqewLn4csF93PEX/0TCk2jdnAytXBZFxFBzKt7wcgo='; connect-src 'self'; font-src 'self'; img-src 'self' data:; media-src 'self';"
  40. # nice
  41. Header add X-Powered-By "http://purl.mro.name/ShaarliGo#v0.1"
  42. # cache assets only (see themes/current/.htaccess)
  43. Header set Cache-Control "no-cache"
  44. Header set Connection Keep-Alive