2.14.4.3. Стандартний .htaccess для MODX

Вміст стандартного .htaccess для MODX (GitHub):

  1. # MODX supports Friendly URLs via this .htaccess file. You must serve web
  2. # pages via Apache with mod_rewrite to use this functionality, and you must
  3. # change the file name from ht.access to .htaccess.
  4. #
  5. # Make sure RewriteBase points to the directory where you installed MODX.
  6. # E.g., "/modx" if your installation is in a "modx" subdirectory.
  7. #
  8. # You may choose to make your URLs non-case-sensitive by adding a NC directive
  9. # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
  10.  
  11. RewriteEngine On
  12. RewriteBase /
  13.  
  14.  
  15. # Prevent rewrite the .well-known directory used by LetsEncrypt by rules below of this rule
  16. RewriteRule "^\.well-known/" - [L]
  17.  
  18.  
  19. # Prevent dot directories (hidden directories like .git) to be exposed to the public
  20. # Except for the .well-known directory used by LetsEncrypt a.o
  21. RewriteRule "/\.|^\.(?!well-known/)" - [F]
  22.  
  23.  
  24. # Rewrite www.example.com -> example.com -- used with SEO Strict URLs plugin
  25. #RewriteCond %{HTTP_HOST} .
  26. #RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
  27. #RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
  28. #
  29. # or for the opposite example.com -> www.example.com use the following
  30. # DO NOT USE BOTH
  31. #
  32. #RewriteCond %{HTTP_HOST} !^$
  33. #RewriteCond %{HTTP_HOST} !^www\. [NC]
  34. #RewriteCond %{HTTP_HOST} (.+)$
  35. #RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L] .
  36.  
  37.  
  38. # Force rewrite to https for every host
  39. #RewriteCond %{HTTPS} !=on [OR]
  40. #RewriteCond %{SERVER_PORT} !^443
  41. #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  42.  
  43.  
  44. # Redirect the manager to a specific domain - don't rename the ht.access file
  45. # in the manager folder to use this this rule
  46. #RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  47. #RewriteCond %{REQUEST_URI} ^/manager [NC]
  48. #RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
  49.  
  50.  
  51. # The Friendly URLs part
  52. RewriteCond %{REQUEST_FILENAME} !-f
  53. RewriteCond %{REQUEST_FILENAME} !-d
  54. RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  55.  
  56.  
  57. # For servers that support output compression, you should pick up a bit of
  58. # speed by un-commenting the following lines.
  59.  
  60. #php_flag zlib.output_compression On
  61. #php_value zlib.output_compression_level 5
Зміст