diff --git a/web_main/.ht.router.php b/web_main/.ht.router.php index b5884ef..97c517f 100644 --- a/web_main/.ht.router.php +++ b/web_main/.ht.router.php @@ -44,7 +44,7 @@ if (str_contains($path, '.php')) { // fallback to index.php. do { $path = dirname($path); - if (preg_match('/\.php$/', $path) && is_file(__DIR__ . $path)) { + if (str_ends_with($path, '.php') && is_file(__DIR__ . $path)) { // Discovered that the path contains an existing PHP file. Use that as the // script to include. $script = ltrim($path, '/'); diff --git a/web_main/.htaccess b/web_main/.htaccess index 902f3cb..5e1dd0c 100644 --- a/web_main/.htaccess +++ b/web_main/.htaccess @@ -3,7 +3,7 @@ # # Protect files and directories from prying eyes. - + Require all denied @@ -22,6 +22,9 @@ DirectoryIndex index.php index.html index.htm AddType image/svg+xml svg svgz AddEncoding gzip svgz +# Add correct encoding for webp. +AddType image/webp .webp + # PHP settings that cannot be changed at runtime can be set here. See # sites/default/default.settings.php and # Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be @@ -140,10 +143,7 @@ AddEncoding gzip svgz RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$ # Allow access to test-specific PHP files: RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?\.php - # Allow access to Statistics module's custom front controller. - # Copy and adapt this rule to directly execute PHP files in contributed or - # custom modules or to run another PHP application in the same directory. - RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics\.php$ + RewriteCond %{REQUEST_URI} !/core/modules/system/tests/modules/legacy_front_controller_test/test_index.php # Deny access to any other PHP files that do not match the rules above. # Specifically, disallow autoload.php from being served directly. RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F] @@ -151,11 +151,21 @@ AddEncoding gzip svgz # Rules to correctly serve gzip compressed CSS and JS files. # Requires both mod_rewrite and mod_headers to be enabled. + # Serve brotli compressed CSS files if they exist and the client accepts brotli. + RewriteCond %{HTTP:Accept-encoding} br + RewriteCond %{REQUEST_FILENAME}\.br -s + RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.br [QSA] + # Serve gzip compressed CSS files if they exist and the client accepts gzip. RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.gz [QSA] + # Serve brotli compressed JS files if they exist and the client accepts brotli. + RewriteCond %{HTTP:Accept-encoding} br + RewriteCond %{REQUEST_FILENAME}\.br -s + RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.br [QSA] + # Serve gzip compressed JS files if they exist and the client accepts gzip. RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s @@ -164,6 +174,8 @@ AddEncoding gzip svgz # Serve correct content types, and prevent double compression. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1] RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1] + RewriteRule \.css\.br$ - [T=text/css,E=no-gzip:1,E=no-brotli:1] + RewriteRule \.js\.br$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1] # Serve correct encoding type. @@ -171,6 +183,13 @@ AddEncoding gzip svgz # Force proxies to cache gzipped & non-gzipped css/js files separately. Header append Vary Accept-Encoding + + + # Serve correct encoding type. + Header set Content-Encoding br + # Force proxies to cache compressed & non-compressed css/js files separately. + Header append Vary Accept-Encoding + diff --git a/web_main/example.gitignore b/web_main/example.gitignore index d77a48b..7124660 100644 --- a/web_main/example.gitignore +++ b/web_main/example.gitignore @@ -18,8 +18,10 @@ /vendor/ # Ignore configuration files that may contain sensitive information. -sites/*/settings*.php -sites/*/services*.yml +sites/*/*settings*.php +!sites/*/default.settings.php +sites/*/*services*.yml +!sites/*/default.services.yml # Ignore paths that contain user-generated content. sites/*/files @@ -32,7 +34,10 @@ sites/simpletest # or delete the previous settings and uncomment the following ones, instead. # Ignore configuration files that may contain sensitive information. -# */settings*.php +# */*settings*.php +# !*/default.settings.php +# */*services*.yml +# !*/default.services.yml # Ignore paths that contain user-generated content. # */files