.htaccess 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #
  2. # Apache/PHP/Drupal settings:
  3. #
  4. # Protect files and directories from prying eyes.
  5. <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
  6. Order allow,deny
  7. </FilesMatch>
  8. # Don't show directory listings for URLs which map to a directory.
  9. Options -Indexes
  10. # Follow symbolic links in this directory.
  11. Options +FollowSymLinks
  12. # Make Drupal handle any 404 errors.
  13. ErrorDocument 404 /index.php
  14. # Force simple error message for requests for non-existent favicon.ico.
  15. # <Files favicon.ico>
  16. # # There is no end quote below, for compatibility with Apache 1.3.
  17. # ErrorDocument 404 "The requested file favicon.ico was not found."
  18. # </Files>
  19. # Set the default handler.
  20. DirectoryIndex index.php index.html index.htm
  21. # Override PHP settings that cannot be changed at runtime. See
  22. # sites/default/default.settings.php and drupal_initialize_variables() in
  23. # includes/bootstrap.inc for settings that can be changed at runtime.
  24. # PHP 5, Apache 1 and 2.
  25. <IfModule mod_php5.c>
  26. php_flag magic_quotes_gpc off
  27. php_flag magic_quotes_sybase off
  28. php_flag register_globals off
  29. php_flag session.auto_start off
  30. php_value mbstring.http_input pass
  31. php_value mbstring.http_output pass
  32. php_flag mbstring.encoding_translation off
  33. </IfModule>
  34. # Requires mod_expires to be enabled.
  35. <IfModule mod_expires.c>
  36. # Enable expirations.
  37. ExpiresActive On
  38. # Cache all files for 2 weeks after access (A).
  39. ExpiresDefault A1209600
  40. <FilesMatch \.php$>
  41. # Do not allow PHP scripts to be cached unless they explicitly send cache
  42. # headers themselves. Otherwise all scripts would have to overwrite the
  43. # headers set by mod_expires if they want another caching behavior. This may
  44. # fail if an error occurs early in the bootstrap process, and it may cause
  45. # problems if a non-Drupal PHP file is installed in a subdirectory.
  46. ExpiresActive Off
  47. </FilesMatch>
  48. </IfModule>
  49. # Various rewrite rules.
  50. <IfModule mod_rewrite.c>
  51. RewriteEngine on
  52. # Block access to "hidden" directories whose names begin with a period. This
  53. # includes directories used by version control systems such as Subversion or
  54. # Git to store control files. Files whose names begin with a period, as well
  55. # as the control files used by CVS, are protected by the FilesMatch directive
  56. # above.
  57. #
  58. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  59. # not possible to block access to entire directories from .htaccess, because
  60. # <DirectoryMatch> is not allowed here.
  61. #
  62. # If you do not have mod_rewrite installed, you should remove these
  63. # directories from your webroot or otherwise protect them from being
  64. # downloaded.
  65. RewriteRule "(^|/)\." - [F]
  66. # If your site can be accessed both with and without the 'www.' prefix, you
  67. # can use one of the following settings to redirect users to your preferred
  68. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  69. #
  70. # To redirect all users to access the site WITH the 'www.' prefix,
  71. # (http://example.com/... will be redirected to http://www.example.com/...)
  72. # uncomment the following:
  73. # RewriteCond %{HTTP_HOST} !^www\. [NC]
  74. # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  75. #
  76. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  77. # (http://www.example.com/... will be redirected to http://example.com/...)
  78. # uncomment the following:
  79. # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  80. # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
  81. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  82. # VirtualDocumentRoot and the rewrite rules are not working properly.
  83. # For example if your site is at http://example.com/drupal uncomment and
  84. # modify the following line:
  85. # RewriteBase /drupal
  86. #
  87. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  88. # uncomment the following line:
  89. RewriteBase /
  90. # Pass all requests not referring directly to files in the filesystem to
  91. # index.php. Clean URLs are handled in drupal_environment_initialize().
  92. RewriteCond %{REQUEST_FILENAME} !-f
  93. RewriteCond %{REQUEST_FILENAME} !-d
  94. RewriteCond %{REQUEST_URI} !=/favicon.ico
  95. RewriteRule ^ index.php [L]
  96. # Rules to correctly serve gzip compressed CSS and JS files.
  97. # Requires both mod_rewrite and mod_headers to be enabled.
  98. <IfModule mod_headers.c>
  99. # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  100. RewriteCond %{HTTP:Accept-encoding} gzip
  101. RewriteCond %{REQUEST_FILENAME}\.gz -s
  102. RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
  103. # Serve gzip compressed JS files if they exist and the client accepts gzip.
  104. RewriteCond %{HTTP:Accept-encoding} gzip
  105. RewriteCond %{REQUEST_FILENAME}\.gz -s
  106. RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
  107. # Serve correct content types, and prevent mod_deflate double gzip.
  108. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
  109. RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
  110. <FilesMatch "(\.js\.gz|\.css\.gz)$">
  111. # Serve correct encoding type.
  112. Header append Content-Encoding gzip
  113. # Force proxies to cache gzipped & non-gzipped css/js files separately.
  114. Header append Vary Accept-Encoding
  115. </FilesMatch>
  116. </IfModule>
  117. </IfModule>
  118. php_value memory_limit 1024M