[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/ -> htaccess.txt (source)

   1  ##
   2  # @package    Joomla
   3  # @copyright  (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
   4  # @license    GNU General Public License version 2 or later; see LICENSE.txt
   5  ##
   6  
   7  ##
   8  # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
   9  #
  10  # The line 'Options +FollowSymLinks' may cause problems with some server configurations.
  11  # It is required for the use of Apache mod_rewrite, but it may have already been set by
  12  # your server administrator in a way that disallows changing it in this .htaccess file.
  13  # If using it causes your site to produce an error, comment it out (add # to the
  14  # beginning of the line), reload your site in your browser and test your sef urls. If
  15  # they work, then it has been set by your server administrator and you do not need to
  16  # set it here.
  17  ##
  18  
  19  ## MISSING CSS OR JAVASCRIPT ERRORS
  20  #
  21  # If your site looks strange after enabling this file, then your server is probably already
  22  # gzipping css and js files and you should comment out the GZIP section of this file.
  23  ##
  24  
  25  ## OPENLITESPEED
  26  #
  27  # If you are using an OpenLiteSpeed web server then any changes made to this file will
  28  # not take effect until you have restarted the web server.
  29  ##
  30  
  31  ## Can be commented out if causes errors, see notes above.
  32  Options +FollowSymlinks
  33  Options -Indexes
  34  
  35  ## No directory listings
  36  <IfModule mod_autoindex.c>
  37      IndexIgnore *
  38  </IfModule>
  39  
  40  ## Suppress mime type detection in browsers for unknown types
  41  <IfModule mod_headers.c>
  42      Header always set X-Content-Type-Options "nosniff"
  43  </IfModule>
  44  
  45  ## Protect against certain cross-origin requests. More information can be found here:
  46  ## https://developer.mozilla.org/en-US/docs/Web/HTTP/Cross-Origin_Resource_Policy_(CORP)
  47  ## https://web.dev/why-coop-coep/
  48  #<IfModule mod_headers.c>
  49  #    Header always set Cross-Origin-Resource-Policy "same-origin"
  50  #    Header always set Cross-Origin-Embedder-Policy "require-corp"
  51  #</IfModule>
  52  
  53  ## Disable inline JavaScript when directly opening SVG files or embedding them with the object-tag
  54  <FilesMatch "\.svg$">
  55    <IfModule mod_headers.c>
  56      Header always set Content-Security-Policy "script-src 'none'"
  57    </IfModule>
  58  </FilesMatch>
  59  
  60  ## These directives are only enabled if the Apache mod_rewrite module is enabled
  61  <IfModule mod_rewrite.c>
  62      RewriteEngine On
  63  
  64      ## Begin - Rewrite rules to block out some common exploits.
  65      # If you experience problems on your site then comment out the operations listed
  66      # below by adding a # to the beginning of the line.
  67      # This attempts to block the most common type of exploit `attempts` on Joomla!
  68      #
  69      # Block any script trying to base64_encode data within the URL.
  70      RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
  71      # Block any script that includes a <script> tag in URL.
  72      RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
  73      # Block any script trying to set a PHP GLOBALS variable via URL.
  74      RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
  75      # Block any script trying to modify a _REQUEST variable via URL.
  76      RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
  77      # Return 403 Forbidden header and show the content of the root home page
  78      RewriteRule .* index.php [F]
  79      #
  80      ## End - Rewrite rules to block out some common exploits.
  81  
  82      ## Begin - Custom redirects
  83      #
  84      # If you need to redirect some pages, or set a canonical non-www to
  85      # www redirect (or vice versa), place that code here. Ensure those
  86      # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
  87      #
  88      ## End - Custom redirects
  89  
  90      ##
  91      # Uncomment the following line if your webserver's URL
  92      # is not directly related to physical file paths.
  93      # Update Your Joomla! Directory (just / for root).
  94      ##
  95  
  96      # RewriteBase /
  97  
  98      ## Begin - Joomla! core SEF Section.
  99      #
 100      # PHP FastCGI fix for HTTP Authorization, required for the API application
 101      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 102      # -- SEF URLs for the API application
 103      # If the requested path starts with /api, the file is not /api/index.php
 104      # and the request has not already been internally rewritten to the
 105      # api/index.php script
 106      RewriteCond %{REQUEST_URI} ^/api/
 107      RewriteCond %{REQUEST_URI} !^/api/index\.php
 108      # and the requested path and file doesn't directly match a physical file
 109      RewriteCond %{REQUEST_FILENAME} !-f
 110      # and the requested path and file doesn't directly match a physical folder
 111      RewriteCond %{REQUEST_FILENAME} !-d
 112      # internally rewrite the request to the /api/index.php script
 113      RewriteRule .* api/index.php [L]
 114      # -- SEF URLs for the public frontend application
 115      # If the requested path and file is not /index.php and the request
 116      # has not already been internally rewritten to the index.php script
 117      RewriteCond %{REQUEST_URI} !^/index\.php
 118      # and the requested path and file doesn't directly match a physical file
 119      RewriteCond %{REQUEST_FILENAME} !-f
 120      # and the requested path and file doesn't directly match a physical folder
 121      RewriteCond %{REQUEST_FILENAME} !-d
 122      # internally rewrite the request to the index.php script
 123      RewriteRule .* index.php [L]
 124      #
 125      ## End - Joomla! core SEF Section.
 126  </IfModule>
 127  
 128  ## These directives are only enabled if the Apache mod_rewrite module is disabled
 129  <IfModule !mod_rewrite.c>
 130      <IfModule mod_alias.c>
 131          # When Apache mod_rewrite is not available, we instruct a temporary redirect
 132          # of the start page to the front controller explicitly so that the website
 133          # and the generated links can still be used.
 134          RedirectMatch 302 ^/$ /index.php/
 135          # RedirectTemp cannot be used instead
 136      </IfModule>
 137  </IfModule>
 138  
 139  ## GZIP
 140  ## These directives are only enabled if the Apache mod_headers module is enabled.
 141  ## This section will check if a .gz file exists and if so will stream it
 142  ##     directly or fallback to gzip any asset on the fly
 143  ## If your site starts to look strange after enabling this file, and you see
 144  ##     ERR_CONTENT_DECODING_FAILED in your browser console network tab,
 145  ##     then your server is already gzipping css and js files and you don't need this
 146  ##     block enabled in your .htaccess
 147  <IfModule mod_headers.c>
 148      # Serve gzip compressed CSS files if they exist
 149      # and the client accepts gzip.
 150      RewriteCond "%{HTTP:Accept-encoding}" "gzip"
 151      RewriteCond "%{REQUEST_FILENAME}\.gz" -s
 152      RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]
 153  
 154      # Serve gzip compressed JS files if they exist
 155      # and the client accepts gzip.
 156      RewriteCond "%{HTTP:Accept-encoding}" "gzip"
 157      RewriteCond "%{REQUEST_FILENAME}\.gz" -s
 158      RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
 159  
 160      # Serve correct content types, and prevent mod_deflate double gzip.
 161      RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
 162      RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
 163  
 164      <FilesMatch "(\.js\.gz|\.css\.gz)$">
 165          # Serve correct encoding type.
 166          Header append Content-Encoding gzip
 167  
 168          # Force proxies to cache gzipped &
 169          # non-gzipped css/js files separately.
 170          Header append Vary Accept-Encoding
 171      </FilesMatch>
 172  </IfModule>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer