Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@

RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]

##
## Rule: Prevent access to package manager metadata and our shipped app list
##
## Context:
## - Mirrors the equivalent `return 404` of our nginx reference configuration
## - Required because `.json` is excluded from the front controller rule
## generated by `lib/private/Setup.php`, so these would otherwise be served
##
RewriteRule ^(?:composer\.(?:json|lock)|package(?:-lock)?\.json|core/shipped\.json)$ - [R=404,L]

##
## Rule: Maps most RFC 8615 compliant well-known URIs to our main frontend controller (/index.php) by default
##
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ public static function updateHtaccess(): bool {
$content .= "\n Options -MultiViews";
$content .= "\n RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
$content .= "\n RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|mjs|json|ftl|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\\.php";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\\.ico|manifest\\.json)$";
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\\.php";
Expand Down